|
| 1 | +name: Release Docker Images |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + packages: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-and-push: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Set up Docker Buildx |
| 19 | + uses: docker/setup-buildx-action@v3 |
| 20 | + |
| 21 | + - name: Login to GHCR |
| 22 | + uses: docker/login-action@v3 |
| 23 | + with: |
| 24 | + registry: ghcr.io |
| 25 | + username: ${{ github.actor }} |
| 26 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + |
| 28 | + - name: Extract version |
| 29 | + id: vars |
| 30 | + shell: bash |
| 31 | + run: | |
| 32 | + TAG=${GITHUB_REF_NAME} |
| 33 | + echo "version=${TAG#v}" >> $GITHUB_OUTPUT |
| 34 | + echo "tag=${TAG}" >> $GITHUB_OUTPUT |
| 35 | +
|
| 36 | + - name: Build and push API image |
| 37 | + uses: docker/build-push-action@v5 |
| 38 | + with: |
| 39 | + context: . |
| 40 | + file: tweetpulse-pipeline/Dockerfile.api |
| 41 | + push: true |
| 42 | + tags: | |
| 43 | + ghcr.io/${{ github.repository_owner }}/tweetpulse-api:latest |
| 44 | + ghcr.io/${{ github.repository_owner }}/tweetpulse-api:${{ steps.vars.outputs.version }} |
| 45 | + ghcr.io/${{ github.repository_owner }}/tweetpulse-api:${{ steps.vars.outputs.tag }} |
| 46 | +
|
| 47 | + - name: Build and push Producer image |
| 48 | + uses: docker/build-push-action@v5 |
| 49 | + with: |
| 50 | + context: . |
| 51 | + file: tweetpulse-pipeline/Dockerfile.producer |
| 52 | + push: true |
| 53 | + tags: | |
| 54 | + ghcr.io/${{ github.repository_owner }}/tweetpulse-producer:latest |
| 55 | + ghcr.io/${{ github.repository_owner }}/tweetpulse-producer:${{ steps.vars.outputs.version }} |
| 56 | + ghcr.io/${{ github.repository_owner }}/tweetpulse-producer:${{ steps.vars.outputs.tag }} |
| 57 | +
|
| 58 | + - name: Build and push Consumer image |
| 59 | + uses: docker/build-push-action@v5 |
| 60 | + with: |
| 61 | + context: . |
| 62 | + file: tweetpulse-pipeline/Dockerfile.consumer |
| 63 | + push: true |
| 64 | + tags: | |
| 65 | + ghcr.io/${{ github.repository_owner }}/tweetpulse-consumer:latest |
| 66 | + ghcr.io/${{ github.repository_owner }}/tweetpulse-consumer:${{ steps.vars.outputs.version }} |
| 67 | + ghcr.io/${{ github.repository_owner }}/tweetpulse-consumer:${{ steps.vars.outputs.tag }} |
| 68 | +
|
| 69 | + - name: Build and push Dashboard image |
| 70 | + uses: docker/build-push-action@v5 |
| 71 | + with: |
| 72 | + context: . |
| 73 | + file: tweetpulse-dashboard/Dockerfile.dashboard |
| 74 | + push: true |
| 75 | + tags: | |
| 76 | + ghcr.io/${{ github.repository_owner }}/tweetpulse-dashboard:latest |
| 77 | + ghcr.io/${{ github.repository_owner }}/tweetpulse-dashboard:${{ steps.vars.outputs.version }} |
| 78 | + ghcr.io/${{ github.repository_owner }}/tweetpulse-dashboard:${{ steps.vars.outputs.tag }} |
0 commit comments