Deploy Prod #6
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: Deploy Prod | |
| on: | |
| workflow_run: | |
| workflows: ["Build and Push"] | |
| types: [completed] | |
| workflow_dispatch: | |
| concurrency: | |
| group: build-and-push | |
| cancel-in-progress: false | |
| env: | |
| TF_DIR: terraform | |
| DOCKER_REPO: "${{ vars.DOCKER_REGISTRY }}/braden-lol" | |
| jobs: | |
| deploy-prod: | |
| name: Deploy Prod | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| - name: Get Web version | |
| id: web-version | |
| uses: martinbeentjes/npm-get-version-action@v1.3.1 | |
| with: | |
| path: apps/web | |
| - name: Get Presence version | |
| id: presence-version | |
| uses: martinbeentjes/npm-get-version-action@v1.3.1 | |
| with: | |
| path: apps/presence | |
| - name: Export environment | |
| run: | | |
| echo "NOMAD_ADDR=${{ vars.NOMAD_ADDR }}" >> $GITHUB_ENV | |
| echo "NOMAD_TOKEN=${{ secrets.NOMAD_TOKEN }}" >> $GITHUB_ENV | |
| echo "AWS_ACCESS_KEY_ID=${{ secrets.TF_STATE_R2_ACCESS_KEY }}" >> $GITHUB_ENV | |
| echo "AWS_SECRET_ACCESS_KEY=${{ secrets.TF_STATE_R2_SECRET_KEY }}" >> $GITHUB_ENV | |
| echo "AWS_ENDPOINT_URL_S3=${{ vars.TF_STATE_R2_ENDPOINT_URL }}" >> $GITHUB_ENV | |
| echo "TF_VAR_web_image_tag=${{ env.DOCKER_REPO }}/web:v${{ steps.web-version.outputs.current-version }}" >> $GITHUB_ENV | |
| echo "TF_VAR_presence_image_tag=${{ env.DOCKER_REPO }}/presence:v${{ steps.presence-version.outputs.current-version }}" >> $GITHUB_ENV | |
| - name: Terraform init | |
| working-directory: ${{ env.TF_DIR }} | |
| run: terraform init | |
| - name: Terraform apply | |
| working-directory: ${{ env.TF_DIR }} | |
| run: terraform apply -auto-approve -input=false |