-
Notifications
You must be signed in to change notification settings - Fork 45
70 lines (62 loc) · 2.53 KB
/
offline.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
on:
push:
branches: [master, develop]
tags: [ v* ]
pull_request:
branches: [master, develop]
jobs:
offline:
name: Prepare offline package
# Useful to skip expensive CI when writing docs
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on:
group: wire-server-deploy
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: cachix/install-nix-action@v27
- uses: cachix/cachix-action@v15
with:
name: wire-server
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
- name: Install nix environment
run: nix-env -f default.nix -iA env
- name: Run offline build
run: ./offline/ci.sh
env:
GPG_PRIVATE_KEY: '${{ secrets.GPG_PRIVATE_KEY }}'
DOCKER_LOGIN: '${{ secrets.DOCKER_LOGIN }}'
- name: Get upload name
id: upload_name
run: |
# FIXME: Tag with a nice release name using the github tag...
# SOURCE_TAG=${GITHUB_REF#refs/tags/}
echo ::set-output name=UPLOAD_NAME::$GITHUB_SHA
# echo ::set-output name=UPLOAD_NAME::${SOURCE_TAG:-$GITHUB_SHA}
- name: Copy assets tarball to S3
run: |
aws s3 cp assets.tgz s3://public.wire.com/artifacts/wire-server-deploy-static-${{ steps.upload_name.outputs.UPLOAD_NAME }}.tgz
echo "Uploaded to: https://s3-$AWS_REGION.amazonaws.com/public.wire.com/artifacts/wire-server-deploy-static-${{ steps.upload_name.outputs.UPLOAD_NAME }}.tgz"
env:
AWS_ACCESS_KEY_ID: '${{ secrets.AWS_ACCESS_KEY_ID }}'
AWS_SECRET_ACCESS_KEY: '${{ secrets.AWS_SECRET_ACCESS_KEY }}'
AWS_REGION: "eu-west-1"
- name: Build and upload wire-server-deploy container
run: |
container_image=$(nix-build --no-out-link -A container)
skopeo copy --retry-times 10 --dest-creds "$DOCKER_LOGIN" \
docker-archive:"$container_image" \
"docker://quay.io/wire/wire-server-deploy:${{ steps.upload_name.outputs.UPLOAD_NAME }}"
env:
DOCKER_LOGIN: '${{ secrets.DOCKER_LOGIN }}'
- name: Deploy offline environment to hetzner
run: |
./offline/cd.sh
env:
HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}'
- name: Clean up hetzner environment; just in case
if: always()
run: (cd terraform/examples/wire-server-deploy-offline-hetzner ; terraform init && terraform destroy -auto-approve)
env:
HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}'