1111 - ' *.md'
1212 - ' **/*.md'
1313jobs :
14- offline :
15- name : Prepare offline package
16- # Useful to skip expensive CI when writing docs
14+ # Build default profile and create local assets
15+ build-default :
16+ name : Build default profile
1717 if : " !contains(github.event.head_commit.message, 'skip ci')"
1818 runs-on :
1919 group : wire-server-deploy
20+ outputs :
21+ upload_name : ${{ steps.upload_name.outputs.UPLOAD_NAME }}
2022 steps :
2123 - uses : actions/checkout@v2
2224 with :
@@ -32,60 +34,177 @@ jobs:
3234
3335 - name : Get upload name
3436 id : upload_name
35- run : |
36- # FIXME: Tag with a nice release name using the github tag...
37- # SOURCE_TAG=${GITHUB_REF#refs/tags/}
38- echo ::set-output name=UPLOAD_NAME::$GITHUB_SHA
39- # echo ::set-output name=UPLOAD_NAME::${SOURCE_TAG:-$GITHUB_SHA}
37+ run : echo "UPLOAD_NAME=$GITHUB_SHA" >> $GITHUB_OUTPUT
4038
41- # deafult profile build
39+ # default profile build
4240 - name : Process the default profile build
4341 run : ./offline/default-build/build.sh
4442 env :
4543 GPG_PRIVATE_KEY : ' ${{ secrets.GPG_PRIVATE_KEY }}'
4644 DOCKER_LOGIN : ' ${{ secrets.DOCKER_LOGIN }}'
4745
48- - name : Copy default build assets tarball to S3 and clean up
46+ # Upload the assets to be shared with other jobs
47+ - name : Upload build artifacts
48+ uses : actions/upload-artifact@v4
49+ with :
50+ name : default-build-assets
51+ path : offline/default-build/output/assets.tgz
52+ retention-days : 1
53+
54+ # Upload to S3 in parallel with deployment
55+ upload-s3 :
56+ name : Upload default build to S3
57+ if : " !contains(github.event.head_commit.message, 'skip ci')"
58+ needs : build-default
59+ runs-on :
60+ group : wire-server-deploy
61+ steps :
62+ - uses : actions/checkout@v2
63+ with :
64+ submodules : true
65+
66+ - name : Download build artifacts
67+ uses : actions/download-artifact@v4
68+ with :
69+ name : default-build-assets
70+ path : offline/default-build/output/
71+
72+ - name : Copy default build assets tarball to S3
4973 run : |
50- # Upload tarball for each profile by specifying their OUTPUT_TAR path
51- aws s3 cp offline/default-build/output/assets.tgz s3://public.wire.com/artifacts/wire-server-deploy-static-${{ steps.upload_name.outputs.UPLOAD_NAME }}.tgz
52- echo "Uploaded to: https://s3-$AWS_REGION.amazonaws.com/public.wire.com/artifacts/wire-server-deploy-static-${{ steps.upload_name.outputs.UPLOAD_NAME }}.tgz"
53- # removing everything except assets.tgz as it is not required anymore in the further builds
54- find offline/default-build/output/ -mindepth 1 -maxdepth 1 ! -name 'assets.tgz' -exec rm -r {} +
74+ aws s3 cp offline/default-build/output/assets.tgz s3://public.wire.com/artifacts/wire-server-deploy-static-${{ needs.build-default.outputs.upload_name }}.tgz
75+ echo "Uploaded to: https://s3-$AWS_REGION.amazonaws.com/public.wire.com/artifacts/wire-server-deploy-static-${{ needs.build-default.outputs.upload_name }}.tgz"
5576 env :
5677 AWS_ACCESS_KEY_ID : ' ${{ secrets.AWS_ACCESS_KEY_ID }}'
5778 AWS_SECRET_ACCESS_KEY : ' ${{ secrets.AWS_SECRET_ACCESS_KEY }}'
5879 AWS_REGION : " eu-west-1"
5980
81+ # Deploy to Hetzner in parallel with S3 upload
82+ deploy-hetzner :
83+ name : Deploy default build to Hetzner
84+ if : " !contains(github.event.head_commit.message, 'skip ci')"
85+ needs : build-default
86+ runs-on :
87+ group : wire-server-deploy
88+ steps :
89+ - uses : actions/checkout@v2
90+ with :
91+ submodules : true
92+ - uses : cachix/install-nix-action@v27
93+ - uses : cachix/cachix-action@v15
94+ with :
95+ name : wire-server
96+ signingKey : " ${{ secrets.CACHIX_SIGNING_KEY }}"
97+
98+ - name : Install nix environment
99+ run : nix-env -f default.nix -iA env
100+
101+ - name : Download build artifacts
102+ uses : actions/download-artifact@v4
103+ with :
104+ name : default-build-assets
105+ path : offline/default-build/output/
106+
107+ - name : Install terraform
108+ uses : hashicorp/setup-terraform@v3
109+ with :
110+ terraform_version : " ^1.3.7"
111+ terraform_wrapper : false
112+
113+ - name : Deploy offline environment to hetzner
114+ run : ./offline/cd-with-retry.sh
115+ env :
116+ HCLOUD_TOKEN : ' ${{ secrets.HCLOUD_TOKEN }}'
117+
118+ # Build container in parallel
119+ build-container :
120+ name : Build container
121+ if : " !contains(github.event.head_commit.message, 'skip ci')"
122+ needs : build-default
123+ runs-on :
124+ group : wire-server-deploy
125+ steps :
126+ - uses : actions/checkout@v2
127+ with :
128+ submodules : true
129+ - uses : cachix/install-nix-action@v27
130+ - uses : cachix/cachix-action@v15
131+ with :
132+ name : wire-server
133+ signingKey : " ${{ secrets.CACHIX_SIGNING_KEY }}"
134+
60135 - name : Build and upload wire-server-deploy container
61136 run : |
62137 container_image=$(nix-build --no-out-link -A container)
63138 skopeo copy --retry-times 10 --dest-creds "$DOCKER_LOGIN" \
64139 docker-archive:"$container_image" \
65- "docker://quay.io/wire/wire-server-deploy:${{ steps.upload_name .outputs.UPLOAD_NAME }}"
140+ "docker://quay.io/wire/wire-server-deploy:${{ needs.build-default .outputs.upload_name }}"
66141 env :
67142 DOCKER_LOGIN : ' ${{ secrets.DOCKER_LOGIN }}'
68143
69- # demo profile build
144+ # Build demo profile
145+ build-demo :
146+ name : Build demo profile
147+ if : " !contains(github.event.head_commit.message, 'skip ci')"
148+ runs-on :
149+ group : wire-server-deploy
150+ steps :
151+ - uses : actions/checkout@v2
152+ with :
153+ submodules : true
154+ - uses : cachix/install-nix-action@v27
155+ - uses : cachix/cachix-action@v15
156+ with :
157+ name : wire-server
158+ signingKey : " ${{ secrets.CACHIX_SIGNING_KEY }}"
159+
160+ - name : Install nix environment
161+ run : nix-env -f default.nix -iA env
162+
163+ - name : Get upload name
164+ id : upload_name
165+ run : echo "UPLOAD_NAME=$GITHUB_SHA" >> $GITHUB_OUTPUT
166+
70167 - name : Process the demo profile build
71168 run : ./offline/demo-build/build.sh
72169 env :
73170 GPG_PRIVATE_KEY : ' ${{ secrets.GPG_PRIVATE_KEY }}'
74171 DOCKER_LOGIN : ' ${{ secrets.DOCKER_LOGIN }}'
75172
76- - name : Copy demo build assets tarball to S3 and clean up
173+ - name : Copy demo build assets tarball to S3
77174 run : |
78- # Upload tarball for each profile by specifying their OUTPUT_TAR path
79175 aws s3 cp offline/demo-build/output/assets.tgz s3://public.wire.com/artifacts/wire-server-deploy-static-demo-${{ steps.upload_name.outputs.UPLOAD_NAME }}.tgz
80176 echo "Uploaded to: https://s3-$AWS_REGION.amazonaws.com/public.wire.com/artifacts/wire-server-deploy-static-demo-${{ steps.upload_name.outputs.UPLOAD_NAME }}.tgz"
81- # remove the assets from the build to optimize the space on the server
82- rm -rf offline/demo-build/output/*
83177 env :
84178 AWS_ACCESS_KEY_ID : ' ${{ secrets.AWS_ACCESS_KEY_ID }}'
85179 AWS_SECRET_ACCESS_KEY : ' ${{ secrets.AWS_SECRET_ACCESS_KEY }}'
86180 AWS_REGION : " eu-west-1"
87181
88- # min profile build
182+ - name : Cleanup demo build assets
183+ run : rm -rf offline/demo-build/output/
184+
185+ # Build min profile
186+ build-min :
187+ name : Build min profile
188+ if : " !contains(github.event.head_commit.message, 'skip ci')"
189+ runs-on :
190+ group : wire-server-deploy
191+ steps :
192+ - uses : actions/checkout@v2
193+ with :
194+ submodules : true
195+ - uses : cachix/install-nix-action@v27
196+ - uses : cachix/cachix-action@v15
197+ with :
198+ name : wire-server
199+ signingKey : " ${{ secrets.CACHIX_SIGNING_KEY }}"
200+
201+ - name : Install nix environment
202+ run : nix-env -f default.nix -iA env
203+
204+ - name : Get upload name
205+ id : upload_name
206+ run : echo "UPLOAD_NAME=$GITHUB_SHA" >> $GITHUB_OUTPUT
207+
89208 - name : Process the min profile build
90209 run : ./offline/min-build/build.sh
91210 env :
@@ -94,30 +213,12 @@ jobs:
94213
95214 - name : Copy min build assets tarball to S3
96215 run : |
97- # Upload tarball for each profile by specifying their OUTPUT_TAR path
98216 aws s3 cp offline/min-build/output/assets.tgz s3://public.wire.com/artifacts/wire-server-deploy-static-min-${{ steps.upload_name.outputs.UPLOAD_NAME }}.tgz
99217 echo "Uploaded to: https://s3-$AWS_REGION.amazonaws.com/public.wire.com/artifacts/wire-server-deploy-static-min-${{ steps.upload_name.outputs.UPLOAD_NAME }}.tgz"
100- # remove the archives from the build to optimize the space on the server
101- rm -rf offline/min-build/output/*
102218 env :
103219 AWS_ACCESS_KEY_ID : ' ${{ secrets.AWS_ACCESS_KEY_ID }}'
104220 AWS_SECRET_ACCESS_KEY : ' ${{ secrets.AWS_SECRET_ACCESS_KEY }}'
105221 AWS_REGION : " eu-west-1"
106222
107- - name : Install terraform
108- uses : hashicorp/setup-terraform@v3
109- with :
110- terraform_version : " ^1.3.7"
111- terraform_wrapper : false
112-
113- - name : Deploy offline environment to hetzner
114- run : |
115- ./offline/cd.sh
116- env :
117- HCLOUD_TOKEN : ' ${{ secrets.HCLOUD_TOKEN }}'
118-
119- # - name: Clean up hetzner environment; just in case
120- # if: always()
121- # run: (cd terraform/examples/wire-server-deploy-offline-hetzner ; terraform init && terraform destroy -auto-approve)
122- # env:
123- # HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}'
223+ - name : Cleanup min build assets
224+ run : rm -rf offline/min-build/output/
0 commit comments