-
Notifications
You must be signed in to change notification settings - Fork 1.9k
189 lines (161 loc) · 5.49 KB
/
deploy-distributables.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# When a new release is created, deploy relevant
# files to each of the generated repos.
name: Deploy Distributable Repos
on:
release:
types: [published]
permissions:
contents: read
jobs:
check-version:
name: Check for updated version
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags
- name: Get latest version
run: |
echo 'LATEST_VERSION<<EOF' >> $GITHUB_ENV
echo $(git describe --tags --abbrev=0) | sed "s/v//" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Search for updated version
if: ${{ env.LATEST_VERSION }}
run: |
chmod +x ${GITHUB_WORKSPACE}/.github/scripts/validate-version
${GITHUB_WORKSPACE}/.github/scripts/validate-version ${{ env.LATEST_VERSION }}
framework:
name: Deploy to framework
permissions:
# Allow actions/github-script to create release
contents: write
if: github.repository == 'codeigniter4/CodeIgniter4'
runs-on: ubuntu-22.04
needs: check-version
steps:
- name: Identify
run: |
git config --global user.email "[email protected]"
git config --global user.name "${GITHUB_ACTOR}"
- name: Checkout source
uses: actions/checkout@v4
with:
path: source
- name: Checkout target
uses: actions/checkout@v4
with:
repository: codeigniter4/framework
token: ${{ secrets.ACCESS_TOKEN }}
path: framework
- name: Chmod
run: chmod +x ./source/.github/scripts/deploy-framework
- name: Deploy
run: ./source/.github/scripts/deploy-framework ${GITHUB_WORKSPACE}/source ${GITHUB_WORKSPACE}/framework ${GITHUB_REF##*/}
- name: Release
uses: actions/github-script@v6
with:
github-token: ${{secrets.ACCESS_TOKEN}}
script: |
const release = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
})
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: 'framework',
tag_name: release.data.tag_name,
name: release.data.name,
body: release.data.body
})
appstarter:
name: Deploy to appstarter
permissions:
# Allow actions/github-script to create release
contents: write
if: github.repository == 'codeigniter4/CodeIgniter4'
runs-on: ubuntu-22.04
needs: check-version
steps:
- name: Identify
run: |
git config --global user.email "[email protected]"
git config --global user.name "${GITHUB_ACTOR}"
- name: Checkout source
uses: actions/checkout@v4
with:
path: source
- name: Checkout target
uses: actions/checkout@v4
with:
repository: codeigniter4/appstarter
token: ${{ secrets.ACCESS_TOKEN }}
path: appstarter
- name: Chmod
run: chmod +x ./source/.github/scripts/deploy-appstarter
- name: Deploy
run: ./source/.github/scripts/deploy-appstarter ${GITHUB_WORKSPACE}/source ${GITHUB_WORKSPACE}/appstarter ${GITHUB_REF##*/}
- name: Release
uses: actions/github-script@v6
with:
github-token: ${{secrets.ACCESS_TOKEN}}
script: |
const release = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
})
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: 'appstarter',
tag_name: release.data.tag_name,
name: release.data.name,
body: release.data.body
})
userguide:
name: Deploy to userguide
permissions:
# Allow actions/github-script to create release
contents: write
if: github.repository == 'codeigniter4/CodeIgniter4'
runs-on: ubuntu-22.04
needs: check-version
steps:
- name: Identify
run: |
git config --global user.email "[email protected]"
git config --global user.name "${GITHUB_ACTOR}"
- name: Checkout source
uses: actions/checkout@v4
with:
path: source
- name: Checkout target
uses: actions/checkout@v4
with:
repository: codeigniter4/userguide
token: ${{ secrets.ACCESS_TOKEN }}
path: userguide
- name: Install Sphinx
run: |
sudo apt install python3-sphinx
sudo pip3 install sphinxcontrib-phpdomain
sudo pip3 install sphinx_rtd_theme
- name: Chmod
run: chmod +x ./source/.github/scripts/deploy-userguide
- name: Deploy
run: ./source/.github/scripts/deploy-userguide ${GITHUB_WORKSPACE}/source ${GITHUB_WORKSPACE}/userguide ${GITHUB_REF##*/}
- name: Release
uses: actions/github-script@v6
with:
github-token: ${{secrets.ACCESS_TOKEN}}
script: |
const release = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
})
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: 'userguide',
tag_name: release.data.tag_name,
name: release.data.name,
body: release.data.body
})