Skip to content

Commit da9a26e

Browse files
committed
added release.yaml
1 parent 493b95d commit da9a26e

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/release.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Docker Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v2
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v2
21+
22+
- name: Log in to DockerHub
23+
uses: docker/login-action@v2
24+
with:
25+
username: ${{ secrets.DOCKER_USERNAME }}
26+
password: ${{ secrets.DOCKER_PASSWORD }}
27+
28+
- name: Extract metadata (tags, labels) for Docker
29+
id: meta
30+
uses: docker/metadata-action@v4
31+
with:
32+
images: petabridge/pbm
33+
34+
- name: Build and push Docker image
35+
uses: docker/build-push-action@v4
36+
with:
37+
context: .
38+
file: ./Dockerfile
39+
platforms: linux/amd64,linux/arm64
40+
push: true
41+
tags: |
42+
petabridge/pbm:latest
43+
petabridge/pbm:${{ github.ref_name }}
44+
labels: ${{ steps.meta.outputs.labels }}
45+
46+
- name: Create and push manifest
47+
run: |
48+
docker manifest create petabridge/pbm:latest \
49+
petabridge/pbm:latest-linux-amd64 \
50+
petabridge/pbm:latest-linux-arm64
51+
docker manifest annotate petabridge/pbm:latest petabridge/pbm:latest-linux-arm64 --arch arm64
52+
docker manifest push petabridge/pbm:latest
53+
54+
- name: Update DockerHub README
55+
uses: docker/metadata-action@v4
56+
with:
57+
images: petabridge/pbm
58+
flavor: latest=false
59+
labels: |
60+
org.opencontainers.image.description=${{ github.event.repository.description }}
61+
readme-filepath: ./README.md
62+
63+
- name: Generate release notes
64+
id: release_notes
65+
run: |
66+
echo "### Release Notes" > release_notes.md
67+
git log --oneline $(git describe --tags --abbrev=0 @^)..@ >> release_notes.md
68+
69+
- name: Create GitHub release
70+
run: |
71+
gh release create ${{ github.ref_name }} release_notes.md --title "Release ${{ github.ref_name }}" --notes-file release_notes.md
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)