Merge pull request #110 from wireapp/config-refs-to-5.29 #50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Prod Env Latest Build and Deploy to S3 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'README.md' | |
| - 'Release.md' | |
| - '.github/**' | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - 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 | |
| - 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: Deploy latest docs to S3 | |
| run: | | |
| mkdir -p tmp_extracted | |
| tar -xzf ./wire-docs.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 to ensure, we don't keep objects at old path | |
| aws s3 rm s3://${{ secrets.BUCKET }}/latest --recursive | |
| # pushing all the latest build documents | |
| aws s3 sync tmp_extracted/latest s3://${{ secrets.BUCKET }}/latest | |
| # syncing the index.html file | |
| aws s3 cp tmp_extracted/index.html s3://${{ secrets.BUCKET }}/index.html | |
| # 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 |