me-matt - feature/CB2-9827 - - 7086091461 #44
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 | |
run-name: "${{ github.actor }} - ${{ github.ref_name }} - ${{ github.head_ref }} - ${{ github.run_id }}" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- feature/CB2-9827 | |
permissions: | |
id-token: write | |
env: | |
BUCKET_NAME: "cvs-services" | |
BUCKET_KEY: "defects-iva" | |
ZIP_NAME: ${{ github.sha }} | |
AWS_REGION: "eu-west-1" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Package | |
run: npm run package | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.CVS_MGMT_AWS_ROLE }} | |
aws-region: eu-west-1 | |
role-session-name: Terraform-GHA | |
- name: Upload to S3 | |
run: | | |
aws s3 cp ${{ env.ZIP_NAME }}.zip s3://${{ env.BUCKET_NAME }}/${{ env.BUCKET_KEY }}/ | |
env: | |
AWS_DEFAULT_REGION: ${{ env.AWS_REGION }} | |
- name: Upload latest hash to S3 | |
run: | | |
current=$(git branch --show-current | tr '[:upper:]' '[:lower:]') | |
branch=${current#feature/} | |
echo ${{ github.sha }} >> latestHash_${branch}.txt | |
aws s3 cp latestHash_${branch}.txt s3://${{ env.BUCKET_NAME }}/${{ env.BUCKET_KEY }}/ | |
- name: Set workspace | |
run: npm run tf:workspace | |
- name: Terraform plan | |
run: TF_VAR_bucket_key=${{ env.BUCKET_KEY }} npm run tf:plan | |
- name: Terraform apply | |
run: npm run tf:apply |