From e71d49af9094a0d89a34cdce315c643efa6064ad Mon Sep 17 00:00:00 2001 From: Caleb Xu Date: Thu, 3 Jul 2025 11:20:05 -0400 Subject: [PATCH] Update GitHub Actions workflows Signed-off-by: Caleb Xu --- .github/workflows/build-main.yml | 27 ++++++++++++++++----------- .github/workflows/build-release.yml | 6 +++--- .github/workflows/ci.yml | 6 +++--- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml index bc574d2..5e1a28e 100644 --- a/.github/workflows/build-main.yml +++ b/.github/workflows/build-main.yml @@ -7,21 +7,26 @@ on: jobs: build-main: name: Build and push a main snapshot image - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version-file: go.mod id: go - - name: Fetch latest release version - uses: reloc8/action-latest-release-version@1.0.0 - id: fetch-latest-release - - name: Set Env Tags - run: echo RELEASE_TAG=${{ steps.fetch-latest-release.outputs.latest-release }}-alpha >> $GITHUB_ENV - - name: Set a default if release tag is empty - if: ${{ steps.fetch-latest-release.outputs.latest-release }} == "" - run: echo RELEASE_TAG=0.0.0 >> $GITHUB_ENV + + - name: Set release version + run: | + RELEASE_TAG=$(gh --repo "${GITHUB_REPOSITORY}" release list \ + --json name,isLatest \ + --jq '.[] | select(.isLatest) | .name') + if [ -z "${RELEASE_TAG}" ]; then + RELEASE_TAG="0.0.0" + fi + echo "RELEASE_TAG=${RELEASE_TAG}" | tee -a "${GITHUB_ENV}" + env: + GH_TOKEN: ${{ github.token }} + - name: Set image registry env run: | echo IMAGE_REGISTRY=$(echo ${{ secrets.IMAGE_REGISTRY }} | cut -d '/' -f 1) >> $GITHUB_ENV diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 0820b53..8e7c48e 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -11,10 +11,10 @@ on: jobs: build-release: name: Build and push a tag image - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version-file: go.mod id: go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6117a2a..fbdbfeb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,12 +7,12 @@ on: jobs: sanity: name: sanity - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version-file: go.mod id: go