added release.yaml (#4) #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |