From 233b35b76c0614c00892178fee1c3d2a71bf2284 Mon Sep 17 00:00:00 2001 From: Aaron Stannard Date: Mon, 23 Dec 2024 16:09:07 -0600 Subject: [PATCH] added release.yaml (#4) --- .github/workflows/release.yaml | 73 ++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..cc5ad92 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,73 @@ +name: Docker Release + +on: + push: + tags: + - '*' + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: petabridge/pbm + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + petabridge/pbm:latest + petabridge/pbm:${{ github.ref_name }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Create and push manifest + run: | + docker manifest create petabridge/pbm:latest \ + petabridge/pbm:latest-linux-amd64 \ + petabridge/pbm:latest-linux-arm64 + docker manifest annotate petabridge/pbm:latest petabridge/pbm:latest-linux-arm64 --arch arm64 + docker manifest push petabridge/pbm:latest + + - name: Update DockerHub README + uses: docker/metadata-action@v4 + with: + images: petabridge/pbm + flavor: latest=false + labels: | + org.opencontainers.image.description=${{ github.event.repository.description }} + readme-filepath: ./README.md + + - name: Generate release notes + id: release_notes + run: | + echo "### Release Notes" > release_notes.md + git log --oneline $(git describe --tags --abbrev=0 @^)..@ >> release_notes.md + + - name: Create GitHub release + run: | + gh release create ${{ github.ref_name }} release_notes.md --title "Release ${{ github.ref_name }}" --notes-file release_notes.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}