Dev Frontend Build and Deploy #388
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: Frontend Bump Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'frontend/**' | |
env: | |
WORKING_DIR: "frontend" | |
DOCKER_FILE: "Dockerfile.azure" | |
DOMAIN_NAME: "ops.opre.acf.gov" | |
jobs: | |
build-frontend: | |
permissions: | |
contents: write | |
packages: write | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
environment: [dev, stage, prod] # Define your environments here | |
steps: | |
- uses: actions/[email protected] | |
- name: 'Automated Version Bump' | |
id: version_bump | |
uses: 'phips28/[email protected]' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag-prefix: 'ops-frontend-v' | |
PACKAGEJSON_DIR: 'frontend' | |
- name: Extract Version | |
id: extract_version | |
run: | | |
VERSION=$(echo "${{ steps.version_bump.outputs.newTag }}" | sed -e 's/.*v\(.*\)/v\1/') | |
echo "::set-output name=version::$VERSION" | |
- name: Build and publish the Docker image for ${{ github.repository }} | |
uses: ./.github/actions/build-and-push | |
with: | |
image_name: ${{ github.repository }}/ops-${{ env.WORKING_DIR }} # it will be lowercased internally | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
context: ${{ github.workspace }}/${{ env.WORKING_DIR }} | |
dockerfile: ${{ github.workspace }}/${{ env.WORKING_DIR }}/${{ env.DOCKER_FILE }} | |
image_tags: "unstable,${{ github.sha }},${{ matrix.environment }},${{ matrix.environment }}-${{ steps.extract_version.outputs.version }}" | |
build_args: "VITE_BACKEND_DOMAIN=https://${{ matrix.environment }}.${{ env.DOMAIN_NAME }}, MODE=${{ matrix.environment }}" | |
outputs: | |
version: ${{ steps.extract_version.outputs.version }} |