Skip to content

Commit 6b18b5f

Browse files
committed
feat: add release package workflow
1 parent 4d9090b commit 6b18b5f

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/release.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- 'v*.*.*' # Only consider tags in the format v0.0.0
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
release-package:
15+
name: Release package
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout Code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Login to GitHub Container Registry
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Extract metadata (tags, labels) for Docker
32+
id: meta
33+
uses: docker/metadata-action@v5
34+
with:
35+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
36+
tags: |
37+
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/main' }}
38+
type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
39+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
40+
41+
- name: Build and push by digest
42+
id: build
43+
uses: docker/build-push-action@v6
44+
with:
45+
context: .
46+
push: true
47+
platforms: linux/amd64
48+
tags: ${{ steps.meta.outputs.tags }}
49+
50+
- name: Inspect image
51+
run: |
52+
TAG=${{ github.ref == 'refs/heads/main' && 'dev' || github.ref_name }}
53+
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${TAG}

0 commit comments

Comments
 (0)