From 38b06d75c64a953b52179b44f6d339638e776eb3 Mon Sep 17 00:00:00 2001 From: scx1332 Date: Sat, 22 Jun 2024 11:42:04 +0200 Subject: [PATCH] workflow for nightly build --- .ci/pack-build.sh | 4 +--- .github/workflows/release.yml | 37 ++++++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/.ci/pack-build.sh b/.ci/pack-build.sh index 024944ec8c..ba3dc55fdb 100644 --- a/.ci/pack-build.sh +++ b/.ci/pack-build.sh @@ -9,7 +9,7 @@ not_empty() { } -not_empty "$GITHUB_REF" GITHUB_REF +not_empty "$TAG_NAME" TAG_NAME not_empty "$OS_NAME" OS_NAME @@ -29,8 +29,6 @@ else fail "unknown os name: $OS_NAME" fi -TAG_NAME="${GITHUB_REF##*/}" - generate_asset() { local asset_type=$1 local bins="$2" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6fcce1596d..1c4ae968f8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -171,7 +171,7 @@ jobs: shell: bash env: OS_NAME: ${{ matrix.os }} - GITHUB_REF: ${{ github.ref }} + TAG_NAME: ${{ github.ref }} run: | bash .ci/pack-build.sh - name: Upload Release Asset [Requestor] @@ -204,15 +204,34 @@ jobs: - name: Check out repository uses: actions/checkout@v4 - - name: Get version from Cargo.toml - id: get_version + - name: Extract Version + id: version1 + if: github.event_name != 'workflow_run' + shell: bash + env: + OS_NAME: ${{ matrix.os }} + GITHUB_REF: ${{ github.ref }} + run: | + TAG_NAME="${GITHUB_REF##*/}" + TAGV_NAME="${TAG_NAME#pre-rel-}" + VERSION=${TAGV_NAME#v} + echo "::set-output name=tagv::${TAG_NAME}" + echo "::set-output name=version::${VERSION}" + + - name: Extract version1 + id: version2 if: github.event_name == 'workflow_run' run: | cargo install --debug toml-cli - # linux - echo NIGHTLY_TAG=pre-rel-v$(toml get --raw Cargo.toml package.version)-nightly >> $GITHUB_OUTPUT - # windows - echo NIGHTLY_TAG=pre-rel-v$(toml get --raw Cargo.toml package.version)-nightly >> $ENV:GITHUB_OUTPUT + # linux version + echo version=v$(toml get --raw Cargo.toml package.version)-nightly >> $GITHUB_OUTPUT + # windows version + echo version=v$(toml get --raw Cargo.toml package.version)-nightly >> $ENV:GITHUB_OUTPUT + + - name: Set tag name + id: version + run: | + echo "tag=${{ steps.version1.outputs.version }}${{ steps.version2.outputs.version }}" >> $GITHUB_OUTPUT - name: Get upload url id: release_upload_url @@ -225,7 +244,7 @@ jobs: try { tag = context.payload.ref.replace(/.*\//, ''); } catch (e) { - tag = "${{ steps.get_version.outputs.NIGHTLY_TAG }}"; + tag = "${{ steps.version.outputs.tag }}"; } let release = await github.request("GET /repos/:owner/:repo/releases/tags/:tag", { owner: context.repo.owner, @@ -262,7 +281,7 @@ jobs: shell: bash env: OS_NAME: linux-aarch64 - GITHUB_REF: ${{ github.ref }} + TAG_NAME: ${{ steps.version.outputs.tag }} run: | bash .ci/pack-build.sh - name: Upload Release Asset [Requestor]