diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index cd0c463..c4f8bec 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -16,16 +16,3 @@ jobs: - name: Docker-compose build run: | docker compose build - - - name: Log in to GitHub Container Registry - if: github.ref == 'refs/heads/main' - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Push nginx image to GitHub Container Registry - if: github.ref == 'refs/heads/main' - run: | - docker push ghcr.io/flavienbwk/nginx-keycloak/nginx-sso:$(grep -oP "(?<=image: ghcr.io/flavienbwk/nginx-keycloak/nginx-sso:).*" docker-compose.yml) diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml new file mode 100644 index 0000000..e528e94 --- /dev/null +++ b/.github/workflows/docker-push.yml @@ -0,0 +1,34 @@ +name: Docker build of nginx-keycloak + +on: + push: + branches: + - main + paths: + - 'Dockerfile' + +jobs: + + docker-build: + name: Ubuntu 22.04 build of nginx-keycloak + runs-on: ubuntu-22.04 + + steps: + + - name: Check Out Repo + uses: actions/checkout@v2 + + - name: Docker-compose build + run: | + docker compose build + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push nginx image to GitHub Container Registry + run: | + docker push ghcr.io/flavienbwk/nginx-keycloak/nginx-sso:$(grep -oP "(?<=image: ghcr.io/flavienbwk/nginx-keycloak/nginx-sso:).*" docker-compose.yml)