From 619556e071462f6e5499e4c3ed9981aca8d1d121 Mon Sep 17 00:00:00 2001 From: sjquant Date: Sun, 1 Sep 2024 17:29:41 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Update=20release=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 38 ++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55f6f5c..770c738 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,8 @@ name: release on: push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" + branches: + - main concurrency: group: ${{ github.sha }} @@ -24,6 +24,10 @@ jobs: os: macos-latest rust: stable target: x86_64-apple-darwin + - build: macos-arm64 + os: macos-latest + rust: stable + target: aarch64-apple-darwin env: RUST_BACKTRACE: full TARGET_DIR: ./target @@ -31,13 +35,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Get the release version from the tag - shell: bash - if: env.FLOPHA_VERSION == '' - run: | - echo "FLOPHA_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - echo "version is: ${{ env.FLOPHA_VERSION }}" - - name: Install packages (Ubuntu) if: matrix.os == 'ubuntu-20.04' run: | @@ -51,6 +48,27 @@ jobs: profile: minimal override: true + - name: Determine version changes + id: version_check + shell: bash + run: | + latest_version=$(git describe --tags --abbrev=0 | sed 's/^v//') + cargo_version=$(cargo pkgid | sed 's/.*#//') + if [ "$latest_version" != "$cargo_version" ]; then + echo "Version has changed to $cargo_version" + echo "version_changed=true" >> $GITHUB_OUTPUT + echo "NEW_VERSION=$cargo_version" >> $GITHUB_ENV + else + echo "Version has not changed" + echo "version_changed=false" >> $GITHUB_OUTPUT + fi + + - name: Skip if version has not changed + if: steps.version_check.outputs.version_changed != 'true' + run: | + echo "Version has not changed, skipping release" + exit 78 + - name: Build and Package shell: bash run: | @@ -60,6 +78,6 @@ jobs: - name: Upload release archive uses: softprops/action-gh-release@v2 with: - tag_name: ${{ env.FLOPHA_VERSION }} + tag_name: ${{ env.NEW_VERSION }} generate_release_notes: True files: ${{ env.ASSET }}