Refactor Application Insight integration in frontend (#41) #21
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: Publish Frontend Docker Image | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "frontend/**" | |
| - ".github/workflows/frontend-image.yml" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Bump frontend version | |
| run: | | |
| cd frontend | |
| npm ci | |
| npm version patch --no-git-tag-version | |
| VERSION=$(node -p 'require("./package.json").version') | |
| echo "VERSION=$VERSION" >> "$GITHUB_ENV" | |
| cd .. | |
| - name: Commit version bump | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "[email protected]" | |
| git add frontend/package.json | |
| git commit -m "chore: bump frontend version to $VERSION" && git push || echo "No changes to commit" | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./frontend | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/global-tsunami-risk-map-frontend:latest | |
| ghcr.io/${{ github.repository_owner }}/global-tsunami-risk-map-frontend:${{ env.VERSION }} |