This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
chore(deploy workflow): update env #7
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
env: | |
INFRA_DIR: 'infra' | |
TF_VAR_USERNAME: ${{ secrets.USERNAME }} | |
TF_VAR_PASSWORD: ${{ secrets.PASSWORD }} | |
TF_VAR_CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
TF_VAR_CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
TF_VAR_CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_ENDPOINT_URL_S3: ${{ secrets.AWS_ENDPOINT_URL_S3 }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
id: install-dependencies | |
run: npm install | |
shell: bash | |
- name: Build worker | |
id: build-worker | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: deploy --dry-run --minify --outdir dist | |
- name: Setup Terraform | |
id: setup-terraform | |
uses: hashicorp/setup-terraform@v3 | |
- name: Terraform Init | |
id: terraform-init | |
run: terraform init | |
shell: bash | |
working-directory: ${{ env.INFRA_DIR }} | |
- name: Terraform Format | |
id: terraform-format | |
run: terraform fmt -check | |
shell: bash | |
working-directory: ${{ env.INFRA_DIR }} | |
- name: Terraform Plan | |
id: terraform-plan | |
run: terraform plan -input=false | |
shell: bash | |
working-directory: ${{ env.INFRA_DIR }} | |
- name: Terraform Apply | |
id: terraform-apply | |
shell: bash | |
working-directory: ${{ env.INFRA_DIR }} | |
run: terraform apply -auto-approve -input=false |