diff --git a/.forgejo/workflows/images.yml b/.forgejo/workflows/images.yml index 7c71f84..a16c626 100644 --- a/.forgejo/workflows/images.yml +++ b/.forgejo/workflows/images.yml @@ -1,4 +1,4 @@ -name: Build Hello World Image +name: Build (and tag) Images on: push: @@ -23,26 +23,29 @@ jobs: username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_TOKEN }} - - name: Set image tag + - name: Set image tags id: vars run: | - if [ "${{ github.ref_name }}" = "main" ]; then + if [ "${{ github.ref_name }}" = "main" ] && [ "${{ github.event_name }}" = "push" ]; then echo "tag=latest" >> $GITHUB_OUTPUT else echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT fi - - name: Build and push web image to Container Registry + - name: Build images run: | + pushd ./web docker build -f ./Containerfile -t git.hamburg.ccc.de/ccchh/sunders/web:${{ steps.vars.outputs.tag }} . - docker push git.hamburg.ccc.de/ccchh/sunders/web:${{ steps.vars.outputs.tag }} - working-directory: ./web - - - name: Build and push data_handler image to Container Registry - run: | + popd + pushd ./data_handler docker build -f ./Containerfile -t git.hamburg.ccc.de/ccchh/sunders/data_handler:${{ steps.vars.outputs.tag }} . + popd + + - name: Push images to Container Registry + run: | + docker push git.hamburg.ccc.de/ccchh/sunders/web:${{ steps.vars.outputs.tag }} docker push git.hamburg.ccc.de/ccchh/sunders/data_handler:${{ steps.vars.outputs.tag }} - working-directory: ./data_handler + if: github.event_name == 'push' && github.ref_name == 'main' - name: Update docker-compose.yml image tags run: | @@ -51,4 +54,4 @@ jobs: - name: Start Docker Compose services run: | docker compose up -d --wait - docker compose down \ No newline at end of file + docker compose down \ No newline at end of file