Skip to content

Commit c0ef409

Browse files
committed
ga: add release action
1 parent 9919e2d commit c0ef409

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: CI
33
on:
44
push:
55
branches: ["main"]
6+
tags:
7+
- "v*.*.*"
68
pull_request:
79
branches: ["main"]
810

@@ -34,7 +36,7 @@ jobs:
3436
name: Build & Push Docker Image
3537
runs-on: ubuntu-latest
3638
needs: test-and-lint
37-
if: github.ref == 'refs/heads/main'
39+
if: github.ref_type == 'tag'
3840
permissions:
3941
contents: read
4042
packages: write
@@ -58,4 +60,26 @@ jobs:
5860
with:
5961
context: .
6062
push: true
61-
tags: ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:latest
63+
tags: |
64+
ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:latest
65+
ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:${{ github.ref_name }}
66+
67+
release:
68+
name: Create GitHub Release
69+
runs-on: ubuntu-latest
70+
needs: build-and-push
71+
if: github.ref_type == 'tag'
72+
permissions:
73+
contents: write
74+
75+
steps:
76+
- name: Checkout code
77+
uses: actions/checkout@v4
78+
79+
- name: Create Release
80+
uses: softprops/action-gh-release@v2
81+
with:
82+
tag_name: ${{ github.ref_name }}
83+
name: Release ${{ github.ref_name }}
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)