Skip to content

Commit

Permalink
workflow for nightly build
Browse files Browse the repository at this point in the history
  • Loading branch information
scx1332 committed Jun 22, 2024
1 parent 963e957 commit 38b06d7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
4 changes: 1 addition & 3 deletions .ci/pack-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ not_empty() {
}


not_empty "$GITHUB_REF" GITHUB_REF
not_empty "$TAG_NAME" TAG_NAME
not_empty "$OS_NAME" OS_NAME


Expand All @@ -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"
Expand Down
37 changes: 28 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 38b06d7

Please sign in to comment.