|
| 1 | +name: release-docker-image |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*' |
| 7 | + |
| 8 | +env: |
| 9 | + IMAGE: zappi/nginx-proxy |
| 10 | + |
| 11 | +jobs: |
| 12 | + github-release: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + - name: Create Release |
| 18 | + uses: actions/create-release@v1 |
| 19 | + env: |
| 20 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 21 | + with: |
| 22 | + tag_name: ${{ github.ref }} |
| 23 | + release_name: Version ${{ github.ref }} |
| 24 | + draft: false |
| 25 | + prerelease: false |
| 26 | + docker-hub-release: |
| 27 | + needs: github-release |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v4 |
| 32 | + - name: Prepare image metadata |
| 33 | + id: metadata |
| 34 | + uses: docker/metadata-action@v5 |
| 35 | + with: |
| 36 | + images: ${{ env.IMAGE }} |
| 37 | + - name: Set up QEMU |
| 38 | + uses: docker/setup-qemu-action@v3 |
| 39 | + - name: Set up Docker Buildx |
| 40 | + uses: docker/setup-buildx-action@v3 |
| 41 | + - name: Login to Docker Hub |
| 42 | + uses: docker/login-action@v3 |
| 43 | + with: |
| 44 | + username: ${{ secrets.DOCKER_HUB_USERNAME }} |
| 45 | + password: ${{ secrets.DOCKER_HUB_TOKEN }} |
| 46 | + - name: Build, tag, and push image to Amazon ECR |
| 47 | + uses: docker/build-push-action@v6 |
| 48 | + with: |
| 49 | + cache-from: type=gha |
| 50 | + cache-to: type=gha,mode=max |
| 51 | + context: . |
| 52 | + labels: ${{ steps.metadata.outputs.labels }} |
| 53 | + platforms: linux/amd64,linux/arm64 |
| 54 | + push: true |
| 55 | + tags: ${{ steps.metadata.outputs.tags }} |
| 56 | + - name: Update description on Docker Hub Description |
| 57 | + uses: peter-evans/dockerhub-description@v4 |
| 58 | + with: |
| 59 | + username: ${{ secrets.DOCKER_HUB_USERNAME }} |
| 60 | + password: ${{ secrets.DOCKER_HUB_TOKEN }} |
| 61 | + repository: ${{ env.IMAGE }} |
0 commit comments