Skip to content

Commit 467c6d0

Browse files
authored
Merge pull request #24 from git-mastery/woojiahao/use-reusable-workflow
Use reusable workflow for fetching tag details
2 parents 94e3083 + f60c189 commit 467c6d0

File tree

1 file changed

+1
-41
lines changed

1 file changed

+1
-41
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,7 @@ permissions:
1919

2020
jobs:
2121
prepare:
22-
runs-on: ubuntu-latest
23-
outputs:
24-
ref_name: ${{ steps.resolve.outputs.ref_name }}
25-
version_number: ${{ steps.resolve.outputs.version_number }}
26-
should_publish: ${{ steps.resolve.outputs.should_publish }}
27-
28-
steps:
29-
- name: Checkout source
30-
uses: actions/checkout@v6
31-
with:
32-
fetch-depth: 0
33-
34-
- name: Get latest tag if not push on tags
35-
id: resolve
36-
env:
37-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38-
run: |
39-
set -e
40-
41-
EVENT="${{ github.event_name }}"
42-
43-
if [[ "$EVENT" == "push" && "${GITHUB_REF_TYPE}" == "tag" ]]; then
44-
TAG="${GITHUB_REF_NAME}"
45-
else
46-
TAG=$(git describe --tags --abbrev=0)
47-
fi
48-
49-
echo "Using tag: $TAG"
50-
51-
# Check if release exists
52-
if gh release view "$TAG" >/dev/null 2>&1; then
53-
SHOULD_PUBLISH=false
54-
echo "Release already exists for $TAG"
55-
else
56-
SHOULD_PUBLISH=true
57-
echo "No release exists for $TAG"
58-
fi
59-
60-
echo "ref_name=$TAG" >> "$GITHUB_OUTPUT"
61-
echo "version_number=${TAG#v}" >> "$GITHUB_OUTPUT"
62-
echo "should_publish=$SHOULD_PUBLISH" >> "$GITHUB_OUTPUT"
22+
uses: git-mastery/actions/.github/workflows/get-latest-tag.yml@main
6323

6424
linux-build:
6525
needs: prepare

0 commit comments

Comments
 (0)