Merge remote-tracking branch 'origin/main' into deployment-to-cloud #33
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: Create and publish Docker images | |
on: | |
push: | |
branches: | |
- main | |
# tags: | |
# - 'v*' | |
env: | |
REGISTRY: rtwcr1.azurecr.io | |
REGISTRY_USERNAME: GitHub-Action | |
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
service: [frontend, services/auth-service, services/analytics-service, services/heatmap-service, services/pin-service, services/update-service] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Filter changes | |
uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
service: | |
- '${{ matrix.service }}/version.txt' | |
- name: Set version environment variable | |
if: steps.changes.outputs.service == 'true' | |
run: | | |
VER=$(cat ${{ matrix.service }}/version.txt) | |
echo "VERSION=$VER" >> $GITHUB_ENV | |
- name: Log in to the Container registry | |
if: steps.changes.outputs.service == 'true' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.REGISTRY_USERNAME }} | |
password: ${{ env.REGISTRY_PASSWORD }} | |
- name: Build and push Docker image (${{ matrix.service }}) | |
if: steps.changes.outputs.service == 'true' | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ matrix.service }} | |
push: true | |
tags: | | |
${{ env.REGISTRY }}/${{ matrix.service }}:latest | |
${{ env.REGISTRY }}/${{ matrix.service }}:${{ env.VERSION }} | |
# tags: ${{ steps.meta.outputs.tags }} | |
# labels: ${{ steps.meta.outputs.labels }} |