|
| 1 | +name: Build and Push to GHCR |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + paths: |
| 9 | + - "**/consumer/**" |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + |
| 14 | +jobs: |
| 15 | + build-and-push: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + permissions: |
| 18 | + contents: read |
| 19 | + packages: write |
| 20 | + steps: |
| 21 | + - name: Check Out Repo |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up Docker Buildx |
| 25 | + uses: docker/setup-buildx-action@v1 |
| 26 | + |
| 27 | + - name: Login to GitHub Container Registry |
| 28 | + uses: docker/login-action@v1 |
| 29 | + with: |
| 30 | + registry: ghcr.io |
| 31 | + username: ${{ github.repository_owner }} |
| 32 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + |
| 34 | + - name: Extract metadata (tags, labels) for Docker |
| 35 | + id: meta |
| 36 | + uses: docker/metadata-action@v3 |
| 37 | + with: |
| 38 | + images: ghcr.io/${{ github.repository }}/consumer |
| 39 | + tags: | |
| 40 | + type=sha,prefix=commit,length=7 |
| 41 | +
|
| 42 | + - name: Build and push to GHCR |
| 43 | + uses: docker/build-push-action@v2 |
| 44 | + with: |
| 45 | + context: packages/consumer |
| 46 | + push: true |
| 47 | + tags: ${{ steps.meta.outputs.tags }} |
| 48 | + |
| 49 | + # - name: Build and push to GHCR |
| 50 | + # uses: docker/build-push-action@v2 |
| 51 | + # with: |
| 52 | + # context: packages/consumer |
| 53 | + # file: ./Dockerfile |
| 54 | + # push: true |
| 55 | + # tags: ghcr.io/${{ github.repository }}/consumer:latest |
| 56 | + |
| 57 | + # - name: Helm Deploy |
| 58 | + # uses: deliverybot/helm@v1 |
| 59 | + # with: |
| 60 | + # release: your-release |
| 61 | + # namespace: your-namespace |
| 62 | + # chart: ./helm-chart |
| 63 | + # values: ./helm-chart/values.yaml |
| 64 | + # token: ${{ secrets.KUBE_TOKEN }} |
0 commit comments