diff --git a/.github/workflows/main.yaml b/.github/workflows/pr.yaml similarity index 98% rename from .github/workflows/main.yaml rename to .github/workflows/pr.yaml index 9c36bab..1694464 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/pr.yaml @@ -1,4 +1,4 @@ -name: Run Tests +name: PR on: push: diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml new file mode 100644 index 0000000..5649ce0 --- /dev/null +++ b/.github/workflows/tag.yaml @@ -0,0 +1,42 @@ +name: Build and push new image version + +on: + create: + tags: + - v* + +jobs: + build_push: + name: Build and Push + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Login to GHCR + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ secrets.ORG_CR_WRITER_USER }} + password: ${{ secrets.ORG_CR_WRITER_PASSWORD }} + + - id: get_version + name: Format docker image tag + uses: battila7/get-version-action@v2 + + - id: repository_owner + name: Format repository owner + uses: ASzc/change-string-case-action@v1 + with: + string: ${{ github.repository_owner }} + + - name: Build and push new docker image + uses: docker/build-push-action@v2 + with: + push: true + context: ./src + file: ./src/Dockerfile + tags: | + ghcr.io/${{ steps.repository_owner.outputs.lowercase }}/oidc-server-mock:latest + ghcr.io/${{ steps.repository_owner.outputs.lowercase }}/oidc-server-mock:${{ steps.get_version.outputs.version-without-v }} + labels: | + org.opencontainers.image.source=${{ github.event.repository.html_url }}