chore: publish latest image on push to main (#19) #2
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: Publish Latest Docker Image | |
| permissions: | |
| packages: write | |
| contents: read | |
| on: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| ORG: 'sprintertech' | |
| REGISTRY: 'ghcr.io' | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the repository | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Log in to GHCR | |
| - name: Log in to GHCR | |
| id: ghcr | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Build and push the Docker image | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| # Pass build arguments for the GitHub credentials | |
| build-args: | | |
| GH_USER_NAME=${{ secrets.GH_USER_NAME }} | |
| GH_USER_TOKEN=${{ secrets.GHCR_TOKEN }} | |
| tags: | | |
| ${{ env.REGISTRY }}/${{ github.repository }}:latest |