diff --git a/.forgejo/workflows/docker.yaml b/.forgejo/workflows/docker.yaml new file mode 100644 index 0000000..dacf266 --- /dev/null +++ b/.forgejo/workflows/docker.yaml @@ -0,0 +1,32 @@ +name: Build and push Docker image + +on: + push: + +jobs: + build-and-publish: + runs-on: docker + steps: + - uses: actions/checkout@v4 + - name: Build latest + uses: https://codeberg.org/umglurf/kaniko-action@main + with: + cache: true + cache_repo: ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}/cache + credentials: | + ${{ vars.DOCKER_REGISTRY }}=${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }} + destinations: | + ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}:latest ${{ vars.REGISTRY_URL }}/${{ github.repository }}:${{ github.sha }} + push: "true" + if: github.ref == 'refs/heads/master' + - name: Build ref + uses: https://codeberg.org/umglurf/kaniko-action@main + with: + cache: true + cache_repo: ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}/cache + credentials: | + ${{ vars.DOCKER_REGISTRY }}=${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }} + destinations: | + ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}:${{ github.ref_name }} ${{ vars.REGISTRY_URL }}/${{ github.repository }}:${{ github.sha }} + push: "true" + if: github.ref != 'refs/heads/master'