|
| 1 | +name: Docker CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + merge_group: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + tags: |
| 14 | + - v* |
| 15 | + |
| 16 | +jobs: |
| 17 | + docker: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + if: github.actor != 'nektos/act' |
| 21 | + |
| 22 | + permissions: |
| 23 | + packages: write |
| 24 | + contents: read |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - uses: docker/login-action@v3 |
| 30 | + if: github.actor != 'dependabot[bot]' |
| 31 | + with: |
| 32 | + username: ${{ vars.DOCKER_USERNAME }} |
| 33 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 34 | + |
| 35 | + - uses: docker/login-action@v3 |
| 36 | + if: github.actor != 'dependabot[bot]' |
| 37 | + with: |
| 38 | + registry: ghcr.io |
| 39 | + username: ${{ github.actor }} |
| 40 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + |
| 42 | + - id: meta |
| 43 | + uses: docker/metadata-action@v5 |
| 44 | + with: |
| 45 | + images: | |
| 46 | + natoboram/gigachad.ts |
| 47 | + ghcr.io/${{ github.repository }} |
| 48 | + tags: | |
| 49 | + type=ref,event=tag |
| 50 | + type=semver,pattern={{major}} |
| 51 | + type=semver,pattern={{major}}.{{minor}} |
| 52 | + type=semver,pattern={{major}}.{{minor}}.{{patch}} |
| 53 | + type=semver,pattern={{version}} |
| 54 | + |
| 55 | + - uses: docker/build-push-action@v6 |
| 56 | + with: |
| 57 | + context: . |
| 58 | + push: ${{ github.ref_type == 'tag' }} |
| 59 | + tags: ${{ steps.meta.outputs.tags }} |
| 60 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments