Merge pull request #5 from doodlewind/codex/docker-base-image #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI-Docker | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - v* | |
| repository_dispatch: | |
| types: [run_build] | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| BASE_DOCKER_IMAGE: ghcr.io/pspdev/psp-packages:latest | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract DOCKER_TAG using tag name | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| echo "DOCKER_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
| - name: Login to Github registry | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| registry: ghcr.io | |
| - name: Push develop to Github registry | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ghcr.io/${{ github.repository }}:develop | |
| build-args: | | |
| BASE_DOCKER_IMAGE=${{ env.BASE_DOCKER_IMAGE }} | |
| - name: Push release to Github registry | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }} | |
| ghcr.io/${{ github.repository }}:latest | |
| build-args: | | |
| BASE_DOCKER_IMAGE=${{ env.BASE_DOCKER_IMAGE }} | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| if: github.repository_owner == 'pspdev' | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Push develop to dockerhub | |
| uses: docker/build-push-action@v5 | |
| if: github.repository_owner == 'pspdev' | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| ${{ github.repository }}:develop | |
| build-args: | | |
| BASE_DOCKER_IMAGE=${{ env.BASE_DOCKER_IMAGE }} | |
| - name: Push release to dockerhub | |
| uses: docker/build-push-action@v5 | |
| if: github.repository_owner == 'pspdev' && startsWith(github.ref, 'refs/tags/') | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| ${{ github.repository }}:${{ env.DOCKER_TAG }} | |
| ${{ github.repository }}:latest | |
| build-args: | | |
| BASE_DOCKER_IMAGE=${{ env.BASE_DOCKER_IMAGE }} |