name: Docker on: push: branches: - master tags: - 'v*' jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set image tag id: meta run: | if [[ "${GITHUB_REF}" == refs/tags/* ]]; then echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT else echo "TAG=latest" >> $GITHUB_OUTPUT fi - name: Login to Forgejo registry uses: docker/login-action@v3 with: registry: git.sinfonie.org username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_TOKEN }} - name: Build image run: | docker build -t git.sinfonie.org/sinfonie/photo26:${{ steps.meta.outputs.TAG }} . - name: Push image run: | docker push git.sinfonie.org/sinfonie/photo26:${{ steps.meta.outputs.TAG }} - name: Tag latest (for master) if: github.ref == 'refs/heads/master' run: | docker tag git.sinfonie.org/sinfonie/photo26:${{ steps.meta.outputs.TAG }} git.sinfonie.org/sinfonie/photo26:latest docker push git.sinfonie.org/sinfonie/photo26:latest