Merge pull request #878 from bcgov/dependabot/npm_and_yarn/web/vitejs… #584
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 Web | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - "web/**" | |
| workflow_dispatch: | |
| env: | |
| WORKING_DIRECTORY: ./web | |
| WEB_IMAGE_NAME: web | |
| WEB_RUNTIME_IMAGE_NAME: web-runtime | |
| WEB_ARTIFACTS_IMAGE_NAME: web-artifacts | |
| GITHUB_IMAGE_REPO: ghcr.io/bcgov/jasper | |
| WEB_BASE_HREF: / | |
| jobs: | |
| build: | |
| name: Build, Create and Push Image | |
| runs-on: ubuntu-latest | |
| outputs: | |
| short_sha: ${{ steps.short_sha.outputs.SHORT_SHA }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| node-major-version: [22] | |
| node-minor-version: [x] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Building Web codebase | |
| uses: ./.github/workflows/actions/build-web | |
| with: | |
| working_directory: ${{ env.WORKING_DIRECTORY }} | |
| node_version: ${{ matrix.node-major-version }}.${{ matrix.node-minor-version }} | |
| - name: Log in to the GHCR | |
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Get short SHA | |
| id: short_sha | |
| run: | | |
| echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 | |
| with: | |
| driver: docker | |
| - name: Setup ${{ env.WEB_IMAGE_NAME }} Image Metadata | |
| id: meta | |
| uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 | |
| with: | |
| images: | | |
| ${{ env.GITHUB_IMAGE_REPO }}/${{ env.WEB_IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=${{ steps.short_sha.outputs.SHORT_SHA }} | |
| - name: Build ${{ env.WEB_IMAGE_NAME }} image | |
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 | |
| with: | |
| push: true | |
| context: . | |
| file: ./docker/web/Dockerfile.release | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| provenance: false | |
| build-args: | | |
| NODE_VERSION=${{ matrix.node-major-version }} | |
| WEB_BASE_HREF=${{ env.WEB_BASE_HREF }} | |
| NGINX_RUNTIME_SRC=../../docker/nginx-runtime | |
| VUE_ON_NGINX_SRC=../../docker/vue-on-nginx | |
| WEB_SRC=../../web | |
| VITE_ENV=${{ github.event.inputs.environment }} | |
| deploy2dev: | |
| name: Deploy to DEV | |
| needs: build | |
| env: | |
| ENVIRONMENT: lz-dev | |
| permissions: | |
| id-token: write | |
| packages: write | |
| runs-on: ubuntu-latest | |
| environment: lz-dev | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Deploy to ${{ env.ENVIRONMENT }} | |
| uses: ./.github/workflows/actions/deploy-app | |
| with: | |
| environment: ${{ env.ENVIRONMENT }} | |
| aws_account: ${{ vars.AWS_ACCOUNT }} | |
| region: ${{ vars.AWS_REGION }} | |
| app_name: ${{ vars.APP_NAME }} | |
| aws_role_arn: ${{ vars.AWS_ROLE_ARN }} | |
| ghcr_token: ${{ secrets.GITHUB_TOKEN }} | |
| github_image_repo: ${{ env.GITHUB_IMAGE_REPO }} | |
| image_name: ${{ env.WEB_IMAGE_NAME }} | |
| tier_name: web | |
| short_sha: ${{ needs.build.outputs.short_sha }} | |
| deploy2test: | |
| name: Deploy to TEST | |
| needs: [build, deploy2dev] | |
| env: | |
| ENVIRONMENT: lz-test | |
| permissions: | |
| id-token: write | |
| packages: write | |
| runs-on: ubuntu-latest | |
| environment: lz-test | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Deploy to ${{ env.ENVIRONMENT }} | |
| uses: ./.github/workflows/actions/deploy-app | |
| with: | |
| environment: ${{ env.ENVIRONMENT }} | |
| aws_account: ${{ vars.AWS_ACCOUNT }} | |
| region: ${{ vars.AWS_REGION }} | |
| app_name: ${{ vars.APP_NAME }} | |
| aws_role_arn: ${{ vars.AWS_ROLE_ARN }} | |
| ghcr_token: ${{ secrets.GITHUB_TOKEN }} | |
| github_image_repo: ${{ env.GITHUB_IMAGE_REPO }} | |
| image_name: ${{ env.WEB_IMAGE_NAME }} | |
| tier_name: web | |
| short_sha: ${{ needs.build.outputs.short_sha }} | |
| deploy2prod: | |
| name: Deploy to PROD | |
| needs: [build, deploy2dev, deploy2test] | |
| env: | |
| ENVIRONMENT: lz-prod | |
| permissions: | |
| id-token: write | |
| packages: write | |
| runs-on: ubuntu-latest | |
| environment: lz-prod | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Deploy to ${{ env.ENVIRONMENT }} | |
| uses: ./.github/workflows/actions/deploy-app | |
| with: | |
| environment: ${{ env.ENVIRONMENT }} | |
| aws_account: ${{ vars.AWS_ACCOUNT }} | |
| region: ${{ vars.AWS_REGION }} | |
| app_name: ${{ vars.APP_NAME }} | |
| aws_role_arn: ${{ vars.AWS_ROLE_ARN }} | |
| ghcr_token: ${{ secrets.GITHUB_TOKEN }} | |
| github_image_repo: ${{ env.GITHUB_IMAGE_REPO }} | |
| image_name: ${{ env.WEB_IMAGE_NAME }} | |
| tier_name: web | |
| short_sha: ${{ needs.build.outputs.short_sha }} |