Skip to content

Commit

Permalink
👷 Update release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sjquant committed Sep 1, 2024
1 parent 717a5f7 commit 4044639
Showing 1 changed file with 36 additions and 11 deletions.
47 changes: 36 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
branches:
- main

concurrency:
group: ${{ github.sha }}
cancel-in-progress: true

jobs:
build-release:
name: build-release ${{ matrix.os }}
name: build-release ${{ matrix.os }} ${{ matrix.rust }} ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
Expand All @@ -24,20 +24,17 @@ 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
steps:
- 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: |
Expand All @@ -51,6 +48,34 @@ jobs:
profile: minimal
override: true

- name: Determine version changes
id: version_check
shell: bash
run: |
latest_release=$(curl -s -H "Authorization: token ${{ github.token }}" \
https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')
echo "Latest release version: $latest_release"
cargo_version=$(cargo pkgid | sed 's/.*#//')
echo "Cargo version: $cargo_version"
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: |
Expand All @@ -60,6 +85,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 }}

0 comments on commit 4044639

Please # to comment.