Skip to content

Commit ad47ec0

Browse files
authored
build(ci): merge tag and main ghcr build release file (#1205)
Signed-off-by: Billy Zha <[email protected]>
1 parent 70c8e86 commit ad47ec0

File tree

2 files changed

+6
-57
lines changed

2 files changed

+6
-57
lines changed

.github/workflows/release-ghcr-main.yml

-47
This file was deleted.

.github/workflows/release-ghcr.yml

+6-10
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ name: release-ghcr
1515

1616
on:
1717
push:
18-
tags:
19-
- v*
18+
tags: [v*]
19+
branches: [main]
2020

2121
jobs:
2222
build:
@@ -26,18 +26,14 @@ jobs:
2626
packages: write
2727
steps:
2828
- name: Checkout
29-
uses: actions/checkout@v3
29+
uses: actions/checkout@v4
3030
- name: prepare
3131
id: prepare
3232
run: |
33-
VERSION=${GITHUB_REF#refs/*/}
34-
BRANCH_NAME=${GITHUB_REF#refs/heads/}
35-
if [[ "${VERSION}" == "${BRANCH_NAME}" ]]; then
36-
VERSION=$(git rev-parse --short HEAD)
37-
fi
38-
echo "ref=ghcr.io/${{ github.repository }}:${VERSION}" >> $GITHUB_OUTPUT
33+
TAG=${GITHUB_REF#refs/*/} # get branch or tag as image tag
34+
echo "ref=ghcr.io/${{ github.repository }}:${TAG}" >> $GITHUB_OUTPUT
3935
- name: docker login
40-
uses: docker/login-action@v2
36+
uses: docker/login-action@v3
4137
with:
4238
registry: ghcr.io
4339
username: ${{ github.actor }}

0 commit comments

Comments
 (0)