-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (55 loc) · 2.39 KB
/
release.yaml
File metadata and controls
68 lines (55 loc) · 2.39 KB
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
name: Build, Deploy and Release Artifact
on:
release:
types: [published]
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Nix
uses: cachix/install-nix-action@v16
- name: Build Archive
id: build_archive
run: |
make archive
if [ ! -f "wire-docs.tar.gz" ]; then
echo "Artifact not found!"
exit 1
fi
mv wire-docs.tar.gz wire-docs-${{ github.ref_name }}.tar.gz
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: eu-west-1
- name: Extract and Deploy docs to S3
run: |
mkdir -p tmp_extracted
tar -xzf ./wire-docs-${{ github.ref_name }}.tar.gz -C tmp_extracted
# fetching upstream versions to retain information on already existing versions
aws s3 cp s3://${{ secrets.BUCKET }}/versions.json tmp_extracted/upstream_versions.json
# merge the both versions.json files and keep the unique entries while giving priority to current versions.json
jq -s '.[0] + .[1] | unique_by(.version + .title)' tmp_extracted/versions.json tmp_extracted/upstream_versions.json > tmp_extracted/all_versions.json
# removing old objects from the bucket for the ref_name to ensure, we don't keep objects at old path
aws s3 rm s3://${{ secrets.BUCKET }}/${{ github.ref_name }} --recursive
# pushing all the ref_name build documents to S3
aws s3 sync tmp_extracted/${{ github.ref_name }} s3://${{ secrets.BUCKET }}/${{ github.ref_name }}
# syncying the all_versions.json with versions.json
aws s3 cp tmp_extracted/all_versions.json s3://${{ secrets.BUCKET }}/versions.json
rm -rf tmp_extracted
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./wire-docs-${{ github.ref_name }}.tar.gz
asset_name: wire-docs-${{ github.ref_name }}.tar.gz
asset_content_type: application/gzip