-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1570 from dwertent/latest-tag
fix: get latest tag
- Loading branch information
Showing
3 changed files
with
35 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,32 +23,24 @@ jobs: | |
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
- name: Check if this is the latest release | ||
- name: Get the latest tag | ||
run: | | ||
LATEST_TAG=$( | ||
curl -L \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ github.token }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/${{ github.repository }}/releases/latest \ | ||
| jq -r '.tag_name' | ||
) | ||
IS_LATEST=${{ $LATEST_TAG == github.event.release.tag_name }} | ||
echo This release is: "${{ github.event.release.tag_name }}" | ||
echo The latest release is: "$LATEST_TAG" | ||
echo "IS_LATEST_RELEASE=$IS_LATEST" >> "$GITHUB_ENV" | ||
git fetch --tags | ||
latest_tag=$(git tag -l | sort -V | tail -n 1) | ||
echo "latest tag: $latest_tag" | ||
echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV | ||
- name: Install docs dependencies | ||
working-directory: doc-site | ||
run: pip install -r requirements.txt | ||
|
||
- name: Update doc site for release | ||
if: ${{ github.event_name == 'release' && env.IS_LATEST_RELEASE != 'true' }} | ||
if: github.event.action == 'released' && github.ref_name != env.LATEST_TAG | ||
working-directory: doc-site | ||
run: mike deploy ${{ github.event.release.tag_name }} --push | ||
|
||
- name: Update doc site for latest release | ||
if: ${{ github.event_name == 'release' && env.IS_LATEST_RELEASE == 'true' }} | ||
if: github.event.action == 'released' && github.ref_name == env.LATEST_TAG | ||
working-directory: doc-site | ||
run: mike deploy ${{ github.event.release.tag_name }} latest -u --push | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters