mirror of
https://github.com/OpenFreeEnergy/openfe.git
synced 2026-06-04 14:14:22 +08:00
Use GitHub API to fetch latest release/version (#1870)
* Use GitHub API to fetch latest release/version * Make it easier to copy and paste into other repos * add some auth * used auth version everywhere
This commit is contained in:
6
.github/workflows/conda_cron.yaml
vendored
6
.github/workflows/conda_cron.yaml
vendored
@@ -40,9 +40,9 @@ jobs:
|
||||
id: latest-version
|
||||
working-directory: openfe_repo
|
||||
run: |
|
||||
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
# slice off the v, ie v0.7.2 -> 0.7.2
|
||||
VERSION=${LATEST_TAG:1}
|
||||
REPO="${{ github.repository }}"
|
||||
VERSION=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/$REPO/releases/latest" | jq -r '.tag_name | ltrimstr("v")')
|
||||
echo $VERSION
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
|
||||
8
.github/workflows/docker.yaml
vendored
8
.github/workflows/docker.yaml
vendored
@@ -78,11 +78,9 @@ jobs:
|
||||
- name: Get Latest Version
|
||||
id: latest-version
|
||||
run: |
|
||||
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
echo $LATEST_TAG
|
||||
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_OUTPUT
|
||||
# slice off the v, ie v0.7.2 -> 0.7.2
|
||||
VERSION=${LATEST_TAG:1}
|
||||
REPO="${{ github.repository }}"
|
||||
VERSION=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/$REPO/releases/latest" | jq -r '.tag_name | ltrimstr("v")')
|
||||
echo $VERSION
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
|
||||
10
.github/workflows/gen-lock-file.yaml
vendored
10
.github/workflows/gen-lock-file.yaml
vendored
@@ -22,14 +22,10 @@ jobs:
|
||||
# This saves me some time since we only need the latest tag
|
||||
- name: Get latest tag
|
||||
id: latest-version
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
LATEST_TAG=$(curl -s -H "Authorization: token $GH_TOKEN" \
|
||||
https://api.github.com/repos/$REPO/tags \
|
||||
| jq -r '.[0].name')
|
||||
VERSION=${LATEST_TAG:1}
|
||||
REPO="${{ github.repository }}"
|
||||
VERSION=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/$REPO/releases/latest" | jq -r '.tag_name | ltrimstr("v")')
|
||||
echo $VERSION
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
|
||||
6
.github/workflows/installer.yaml
vendored
6
.github/workflows/installer.yaml
vendored
@@ -25,9 +25,9 @@ jobs:
|
||||
- name: Get Latest Version
|
||||
id: latest-version
|
||||
run: |
|
||||
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
# slice off the v, ie v0.7.2 -> 0.7.2
|
||||
VERSION=${LATEST_TAG:1}
|
||||
REPO="${{ github.repository }}"
|
||||
VERSION=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/$REPO/releases/latest" | jq -r '.tag_name | ltrimstr("v")')
|
||||
echo $VERSION
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user