|
| 1 | +name: Main |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'master' |
| 7 | + |
| 8 | +env: |
| 9 | + REGISTRY: ghcr.io |
| 10 | + IMAGE_NAME: ${{ github.repository }} |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-and-push-image: |
| 14 | + name: Build and push image |
| 15 | + runs-on: ubuntu-latest |
| 16 | + permissions: |
| 17 | + contents: read |
| 18 | + packages: write |
| 19 | + steps: |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v2 |
| 22 | + |
| 23 | + - name: Log in to the Container registry |
| 24 | + uses: docker/login-action@v1 |
| 25 | + with: |
| 26 | + registry: ${{ env.REGISTRY }} |
| 27 | + username: ${{ github.actor }} |
| 28 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + |
| 30 | + - name: Extract metadata (tags, labels) for Docker |
| 31 | + id: meta |
| 32 | + uses: docker/metadata-action@v3 |
| 33 | + with: |
| 34 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 35 | + tags: | |
| 36 | + type=raw,value=latest |
| 37 | + |
| 38 | + - name: Build and push Docker image |
| 39 | + uses: docker/build-push-action@v2 |
| 40 | + with: |
| 41 | + context: . |
| 42 | + push: true |
| 43 | + tags: ${{ steps.meta.outputs.tags }} |
| 44 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments