Skip to content

Commit

Permalink
programmatically get latest tag in GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
jub0bs committed Jan 27, 2025
1 parent e302ef9 commit 963e804
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/cors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,21 @@ jobs:
name: Benchmark comparison ${{ matrix.os }} @ Go ${{ matrix.go-version }}
runs-on: ${{ matrix.os }}
steps:
- name: Check out Code (old)
uses: actions/checkout@v4
with:
ref: v0.5.3
path: old
- name: Check out Code (new)
uses: actions/checkout@v4
with:
path: new
fetch-depth: '0'
- name: Retrieve latest tag
id: latest-tag
run: |
cd new
echo "LATEST_TAG=$(git for-each-ref --sort=-version:refname --format='%(refname:lstrip=2)' --count=1 refs/tags)" >> "$GITHUB_OUTPUT"
- name: Check out Code (old)
uses: actions/checkout@v4
with:
ref: ${{ steps.latest-tag.outputs.LATEST_TAG }}
path: old
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
Expand Down

0 comments on commit 963e804

Please sign in to comment.