event -> github.event

This commit is contained in:
41666 2020-12-06 19:42:01 -05:00
parent a0031d4c2b
commit bbdea9c074

View file

@ -70,8 +70,8 @@ jobs:
docker push $2 docker push $2
} }
UI_IMAGE_SRC=ghcr.io/roleypoly/ui${{event.inputs.ui_tag}} UI_IMAGE_SRC=ghcr.io/roleypoly/ui${{github.event.inputs.ui_tag}}
UI_IMAGE_DEST_BASE=docker.pkg.dev/roleypoly/roleypoly/ui:${{event.inputs.environment}} UI_IMAGE_DEST_BASE=docker.pkg.dev/roleypoly/roleypoly/ui:${{github.event.inputs.environment}}
docker pull $UI_IMAGE_SRC docker pull $UI_IMAGE_SRC
retag_push $UI_IMAGE_SRC us-$UI_IMAGE_DEST_BASE retag_push $UI_IMAGE_SRC us-$UI_IMAGE_DEST_BASE
@ -79,8 +79,8 @@ jobs:
retag_push $UI_IMAGE_SRC asia-$UI_IMAGE_DEST_BASE retag_push $UI_IMAGE_SRC asia-$UI_IMAGE_DEST_BASE
echo ::set-output name=ui_tag::@$(docker inspect $UI_IMAGE_SRC -f '{{.Id}}') echo ::set-output name=ui_tag::@$(docker inspect $UI_IMAGE_SRC -f '{{.Id}}')
BOT_IMAGE_SRC=ghcr.io/roleypoly/bot${{event.inputs.bot_tag}} BOT_IMAGE_SRC=ghcr.io/roleypoly/bot${{github.event.inputs.bot_tag}}
BOT_IMAGE_DEST_BASE=docker.pkg.dev/roleypoly/roleypoly/bot:${{event.inputs.environment}} BOT_IMAGE_DEST_BASE=docker.pkg.dev/roleypoly/roleypoly/bot:${{github.event.inputs.environment}}
docker pull $BOT_IMAGE_SRC docker pull $BOT_IMAGE_SRC
retag_push $BOT_IMAGE_SRC us-$BOT_IMAGE_DEST_BASE retag_push $BOT_IMAGE_SRC us-$BOT_IMAGE_DEST_BASE
@ -109,31 +109,31 @@ jobs:
- name: Pull necessary artifacts - name: Pull necessary artifacts
run: | run: |
currentHash=${{ github.sha }} currentHash=${{ github.sha }}
selectedTargetArtifact=${${{ event.inputs.worker_tag }}:-$currentHash} selectedTargetArtifact=${${{ github.event.inputs.worker_tag }}:-$currentHash}
mkdir worker-dist mkdir worker-dist
gsutil cp gs://roleypoly-artifacts/backend-worker/$selectedTargetArtifact/script.js worker-dist/backend-worker.js gsutil cp gs://roleypoly-artifacts/backend-worker/$selectedTargetArtifact/script.js worker-dist/backend-worker.js
- run: terraform init --backend-config "prefix=${{event.inputs.environment}}" - run: terraform init --backend-config "prefix=${{github.event.inputs.environment}}"
- name: Write tags to tags.tfvars.auto.json - name: Write tags to tags.tfvars.auto.json
run: | run: |
echo '{"ui_tag": "${{needs.docker_sync.outputs.ui_tag}}", "bot_tag": "${{needs.docker_sync.outputs.bot_tag}}", "worker_path": "./worker-dist/backend-worker.js"}' | jq | tee tags.tfvars.auto.json echo '{"ui_tag": "${{needs.docker_sync.outputs.ui_tag}}", "bot_tag": "${{needs.docker_sync.outputs.bot_tag}}", "worker_path": "./worker-dist/backend-worker.js"}' | jq | tee tags.tfvars.auto.json
- name: Write TF_DATA_${{event.inputs.environment}} to actions.tfvars.auto.json - name: Write TF_DATA_${{github.event.inputs.environment}} to actions.tfvars.auto.json
run: | run: |
sh -c 'echo '$TF_DATA' | jq > actions.tfvars.auto.json' >/dev/null 2>&1 sh -c 'echo '$TF_DATA' | jq > actions.tfvars.auto.json' >/dev/null 2>&1
env: env:
TF_DATA: ${{ secrets['TF_DATA_'+event.inputs.environment] }} TF_DATA: ${{ secrets['TF_DATA_'+github.event.inputs.environment] }}
- run: | - run: |
terraform plan \ terraform plan \
--var-file variables/global.tfvars \ --var-file variables/global.tfvars \
--var-file variables/${{event.inputs.environment}}.tfvars \ --var-file variables/${{github.event.inputs.environment}}.tfvars \
-out=./deployment.tfplan -out=./deployment.tfplan
- run: | - run: |
terraform apply \ terraform apply \
--var-file variables/global.tfvars \ --var-file variables/global.tfvars \
--var-file variables/${{event.inputs.environment}}.tfvars \ --var-file variables/${{github.event.inputs.environment}}.tfvars \
deployment.tfplan deployment.tfplan