Ironbank Image Upload #30
This file contains 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: | |
inputs: | |
version_number: | |
description: "Version number of the Parabol application image to process" | |
required: true | |
jobs: | |
pull-and-upload: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: "read" | |
id-token: "write" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup environment variables | |
run: | | |
DOCKER_REPOSITORY_FOR_REF=${{ secrets.GCP_AR_PARABOL}} | |
echo "DOCKER_REPOSITORY_FOR_REF=${DOCKER_REPOSITORY_FOR_REF}" >> $GITHUB_ENV | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- 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 ${{ env.DOCKER_REPOSITORY_FOR_REF }}:v${{ github.event.inputs.version_number }} | |
- name: Create temporary container | |
run: | | |
docker create --name temp-container ${{ env.DOCKER_REPOSITORY_FOR_REF }}:v${{ github.event.inputs.version_number }} | |
- 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/tools/ip-to-server_id ./ip-to-server_id | |
- name: Zip the files | |
run: zip -r ${{ github.event.inputs.version_number }}.zip dist build ip-to-server_id | |
- name: Set up AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.IRONBANK_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.IRONBANK_AWS_SECRET_ACCESS_KEY }} | |
aws-region: "us-east-1" | |
- name: Upload to S3 | |
run: | | |
aws s3 cp ${{ github.event.inputs.version_number }}.zip s3://ironbank-proving-ground-action-files.parabol.co/${{ github.event.inputs.version_number }}.zip | |
- name: Upload to GCS | |
uses: actions-hub/gcloud@master | |
env: | |
CLOUDSDK_AUTH_ACCESS_TOKEN: "${{ steps.auth.outputs.access_token }}" | |
with: | |
args: storage cp ${{ github.event.inputs.version_number }}.zip gs://ironbank-proving-ground/${{ github.event.inputs.version_number }}.zip | |
cli: gcloud |