Ironbank Image Upload #72
Workflow file for this run
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: Ironbank Image Upload | |
| on: workflow_dispatch | |
| jobs: | |
| pull-and-upload: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| steps: | |
| - name: Verify if running from a Tag | |
| if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| run: | | |
| echo "This workflow is intended to run only from a Git Tag (e.g., v1.0.0)." | |
| echo "Current reference is: ${{ github.ref }}" | |
| # Force fail the job | |
| exit 1 | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - id: "auth" | |
| name: "Authenticate to Google Cloud" | |
| uses: "google-github-actions/auth@v2" | |
| with: | |
| token_format: "access_token" | |
| workload_identity_provider: ${{ secrets.GCP_WI_PROVIDER_NAME }} | |
| service_account: ${{ secrets.GCP_SA_EMAIL }} | |
| - uses: "docker/login-action@v3" | |
| with: | |
| registry: ${{ secrets.GCP_DOCKER_REGISTRY }} | |
| username: "oauth2accesstoken" | |
| password: "${{ steps.auth.outputs.access_token }}" | |
| - name: Pull Docker image from GCP | |
| run: docker pull ${{ secrets.GCP_AR_PARABOL }}:${{ github.ref_name }} | |
| - name: Create temporary container | |
| run: | | |
| docker create --name temp-container ${{ secrets.GCP_AR_PARABOL }}:${{ github.ref_name }} | |
| - name: Copy files from container | |
| run: | | |
| docker cp temp-container:/home/node/parabol/dist ./dist | |
| docker cp temp-container:/home/node/parabol/build ./build | |
| docker cp temp-container:/home/node/parabol/pnpm-lock.yaml ./pnpm-lock.yaml | |
| docker cp temp-container:/home/node/tools/ip-to-server_id ./ip-to-server_id | |
| - name: Zip the files | |
| run: zip -r ${{ github.ref_name }}.zip dist build pnpm-lock.yaml ip-to-server_id | |
| - name: Upload to GCS | |
| uses: actions-hub/gcloud@master | |
| env: | |
| CLOUDSDK_AUTH_ACCESS_TOKEN: "${{ steps.auth.outputs.access_token }}" | |
| with: | |
| args: storage cp ${{ github.ref_name }}.zip gs://parabol-ironbank-resources/${{ github.ref_name }}.zip | |
| cli: gcloud | |
| - name: USEFUL INFORMATION | |
| run: | | |
| node_version=$(jq -r -j '.engines.node|ltrimstr("^")' package.json) | |
| release_filename="${{ github.ref_name }}.zip" | |
| sha256=$(sha256sum "$release_filename" | awk '{ print $1 }') | |
| echo "Parabol version: ${{ github.ref_name }}" | |
| echo "File location: https://storage.googleapis.com/parabol-ironbank-resources/$release_filename" | |
| echo "SHA-256: $sha256" | |
| echo "NodeJS version: $node_version" | |
| - name: Report Status | |
| if: failure() | |
| uses: ravsamhq/notify-slack-action@v2 | |
| with: | |
| status: ${{ job.status }} | |
| notify_when: "failure" | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GH_ACTIONS_NOTIFICATIONS }} |