Skip to content

Commit

Permalink
ci: update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
lixd authored Jul 25, 2024
2 parents eac3f9d + e7a5425 commit 244d778
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/buid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,21 @@ jobs:
with:
fetch-depth: 0

- name: Get branch name
- name: Get tag or branch
id: extract_branch
shell: bash
run: echo ::set-output name=branch::${GITHUB_REF#refs/heads/}
run: |
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null)
branch=${GITHUB_REF#refs/heads/}
if [[ "$branch" == "master" || "$branch" == "main" ]]; then
ref_name=$branch
elif [[ -n "$latest_tag" ]]; then
ref_name=$latest_tag
else
ref_name=$branch
fi
echo "The ref name is $ref_name"
echo "##[set-output name=branch;]${ref_name}"
- name: Setup node env and build
uses: actions/setup-node@v3
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,21 @@ jobs:
cache: 'yarn'
cache-dependency-path: yarn.lock

- name: Extract Tag
id: extract_tag
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: Get tag or branch
id: extract_branch
shell: bash
run: |
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null)
branch=${GITHUB_REF#refs/heads/}
if [[ "$branch" == "master" || "$branch" == "main" ]]; then
ref_name=$branch
elif [[ -n "$latest_tag" ]]; then
ref_name=$latest_tag
else
ref_name=$branch
fi
echo "The ref name is $ref_name"
echo "##[set-output name=branch;]${ref_name}"
- name: Build
run: |
Expand Down

0 comments on commit 244d778

Please sign in to comment.