-
Notifications
You must be signed in to change notification settings - Fork 5
201 lines (169 loc) Β· 6.27 KB
/
release.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
190
191
192
193
194
195
196
197
198
199
200
201
name: π Release
on:
push:
branches: [main, alpha]
jobs:
release:
runs-on: ubuntu-latest
outputs:
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
last_release_version: ${{ steps.semantic.outputs.last_release_version }}
steps:
- name: πΎ Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: π§Ή Cleanup apt list
uses: christopherpickering/[email protected]
- name: β Setup node
uses: actions/setup-node@v3
with:
node-version: 18
- name: π₯ Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: π Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: πΆ Setup Poetry
uses: snok/install-poetry@v1
- name: π Semantic Release
uses: cycjimmy/semantic-release-action@v3
id: semantic
with:
semantic_version: 18
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
- name: π¦ Packaging Install deps
if: steps.semantic.outputs.new_release_published == 'true'
run: |
sudo apt-get update
sudo apt-get install dh-make devscripts dpkg-dev gzip apt-utils -y
- name: ποΈ Load GPG Keys
if: steps.semantic.outputs.new_release_published == 'true'
run: |
# gpg --export-secret-keys <key id> | base64
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
env:
GPG_SIGNING_KEY: ${{ secrets.PPA_GPG_SECRET }}
- name: πΎ Checkout
if: steps.semantic.outputs.new_release_published == 'true'
uses: actions/checkout@v3
with:
persist-credentials: false
path: atlas
- name: ποΈ Build .deb
if: steps.semantic.outputs.new_release_published == 'true'
run: |
cd ./atlas/packages
cp -r "atlas-hub-<version>" "atlas-hub-$VERSION"
cd "atlas-hub-$VERSION"
find . -type f -name "*" -exec sed -i'' -e "s/<version>/$VERSION/g" {} +
echo "building"
debuild --no-tgz-check -us -uc
cd ..
ls
env:
VERSION: ${{ steps.semantic.outputs.new_release_version }}
- name: πΎ Checkout PPA
if: steps.semantic.outputs.new_release_published == 'true'
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
repository: atlas-bi/ppa
token: ${{ secrets.PPA_REPO_PAT }}
path: ppa
- name: π Move deb to PPA
if: github.ref_name == 'main' && steps.semantic.outputs.new_release_published == 'true'
run: |
cp ./atlas/packages/*.deb ./ppa/deb/pool/stable
- name: π Move alpha deb to PPA
if: github.ref_name == 'alpha' && steps.semantic.outputs.new_release_published == 'true'
run: |
cp ./atlas/packages/*.deb ./ppa/deb/pool/unstable
- name: πΎ Commit changes
if: steps.semantic.outputs.new_release_published == 'true'
run: |
cd ./ppa
git config --local user.name "$USER"
git config --local user.email "$EMAIL"
git add .
git commit -m "added atlas-hub $VERSION"
env:
VERSION: ${{ steps.semantic.outputs.new_release_version }}
USER: ${{ secrets.GIT_USER }}
EMAIL: ${{ secrets.GIT_EMAIL }}
- name: π€ Push changes
if: steps.semantic.outputs.new_release_published == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PPA_REPO_PAT }}
branch: master
directory: ppa
repository: atlas-bi/ppa
# validate-latest:
# needs: release
# runs-on: ubuntu-latest
# steps:
# - name: Sleep for 5 mins for apt to update
# run: sleep 300s
# shell: bash
# - name: update apt list
# if: needs.release.outputs.new_release_published == 'true'
# run: |
# sudo apt update
# sudo apt install curl gnupg2
# curl -s "https://packages.atlas.bi/scripts/deb.sh" | sudo bash -
# # add alpha builds
# echo "deb [arch=all] https://packages.atlas.bi/deb/ ./unstable main" | sudo tee -a /etc/apt/sources.list.d/atlas.list
# sudo apt update
# - name: install
# if: needs.release.outputs.new_release_published == 'true'
# run: sudo apt install -y atlas-hub=$VERSION
# env:
# VERSION: ${{ needs.release.outputs.new_release_version }}
# - name: check install is online
# if: needs.release.outputs.new_release_published == 'true'
# run: |
# curl https://raw.githubusercontent.com/orangemug/bash-assert/master/assert.sh > assert.sh
# source ./assert.sh
# assert $(curl -s -o /dev/null -w "%{http_code}" localhost/login) -eq 200
# # we can login?
# if [[ ! $(curl -X POST localhost/login?user=admin 2> /dev/null | grep -oP href=\"/\") == href=\"/\" ]]; then exit 1; fi
# - name: uninstall
# if: needs.release.outputs.new_release_published == 'true'
# run: sudo apt remove atlas-hub
# validate-upgrade:
# needs: release
# runs-on: ubuntu-latest
# steps:
# - name: Sleep for 5 mins for apt to update
# run: sleep 300s
# shell: bash
# - name: update apt list
# if: needs.release.outputs.new_release_published == 'true'
# run: |
# sudo apt update
# sudo apt install curl gnupg2
# curl -s "https://packages.atlas.bi/scripts/deb.sh" | sudo bash -
# # add alpha builds
# echo "deb [arch=all] https://packages.atlas.bi/deb/ ./unstable main" | sudo tee -a /etc/apt/sources.list.d/atlas.list
# sudo apt update
# - name: install
# if: needs.release.outputs.new_release_published == 'true'
# run: sudo apt install -y atlas-hub=$VERSION
# env:
# VERSION: ${{ needs.release.outputs.last_release_version }}
# - name: upgrade
# if: needs.release.outputs.new_release_published == 'true'
# run: sudo apt install -y atlas-hub=$VERSION
# env:
# VERSION: ${{ needs.release.outputs.new_release_version }}
# - name: uninstall
# if: needs.release.outputs.new_release_published == 'true'
# run: sudo apt remove atlas-hub