mirror of https://github.com/hannobraun/Fornjot
Merge pull request #1324 from kopackiw/issue-883
Unify release flags and correctly mark dev build releases
This commit is contained in:
commit
fed6533f54
|
@ -11,17 +11,39 @@ env:
|
||||||
# used to rename and upload the binaries
|
# used to rename and upload the binaries
|
||||||
PROJ_NAME: fj-app
|
PROJ_NAME: fj-app
|
||||||
|
|
||||||
# This lets our app know it's an "official" release. Otherwise we would get
|
|
||||||
# a version number like "fj-app 0.8.0 (8cb928bb, unreleased)"
|
|
||||||
FJ_OFFICIAL_RELEASE: 1
|
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
calculate-release-flags:
|
||||||
|
name: Calculate release flags
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
release-detected: ${{ steps.release.outputs.release-detected }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Operator | Cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
key: release-operator-01
|
||||||
|
|
||||||
|
- name: Operator | Deduce
|
||||||
|
id: release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
RELEASE_LABEL: release
|
||||||
|
RUST_LOG: info
|
||||||
|
run: |
|
||||||
|
# Run release operator
|
||||||
|
cargo run -p release-operator -- detect
|
||||||
|
|
||||||
binaries:
|
binaries:
|
||||||
name: Binaries
|
name: Binaries
|
||||||
|
needs: calculate-release-flags
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
@ -30,7 +52,7 @@ jobs:
|
||||||
- { target: aarch64-apple-darwin, os: macOS-latest }
|
- { target: aarch64-apple-darwin, os: macOS-latest }
|
||||||
- { target: x86_64-pc-windows-msvc, os: windows-latest }
|
- { target: x86_64-pc-windows-msvc, os: windows-latest }
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
@ -45,6 +67,10 @@ jobs:
|
||||||
|
|
||||||
- name: Binaries | Compile
|
- name: Binaries | Compile
|
||||||
run: cargo build --release --target ${{ matrix.target }}
|
run: cargo build --release --target ${{ matrix.target }}
|
||||||
|
env:
|
||||||
|
# This lets our app know it's an "official" release. Otherwise we would get
|
||||||
|
# a version number like "fj-app 0.8.0 (8cb928bb, unreleased)"
|
||||||
|
RELEASE_DETECTED: ${{ needs.calculate-release-flags.outputs.release-detected }}
|
||||||
|
|
||||||
- name: Binaries | Prepare upload
|
- name: Binaries | Prepare upload
|
||||||
run: |
|
run: |
|
||||||
|
@ -69,7 +95,10 @@ jobs:
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
needs: binaries
|
if: ${{ needs.calculate-release-flags.outputs.release-detected == 'true' }}
|
||||||
|
needs:
|
||||||
|
- calculate-release-flags
|
||||||
|
- binaries
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -80,22 +109,10 @@ jobs:
|
||||||
with:
|
with:
|
||||||
key: release-operator-01
|
key: release-operator-01
|
||||||
|
|
||||||
- name: Operator | Deduce
|
|
||||||
id: release
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
RELEASE_LABEL: release
|
|
||||||
RUST_LOG: info
|
|
||||||
run: |
|
|
||||||
# Run release operator
|
|
||||||
cargo run -p release-operator -- detect
|
|
||||||
|
|
||||||
- name: Binaries | Download
|
- name: Binaries | Download
|
||||||
if: ${{ steps.release.outputs.release-detected == 'true' }}
|
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
|
|
||||||
- name: Binaries | Checksums
|
- name: Binaries | Checksums
|
||||||
if: ${{ steps.release.outputs.release-detected == 'true' }}
|
|
||||||
run: |
|
run: |
|
||||||
# Build binary checksums
|
# Build binary checksums
|
||||||
for file in "${PROJ_NAME}"-*/"${PROJ_NAME}"-*; do
|
for file in "${PROJ_NAME}"-*/"${PROJ_NAME}"-*; do
|
||||||
|
@ -105,7 +122,6 @@ jobs:
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Release | GitHub
|
- name: Release | GitHub
|
||||||
if: ${{ steps.release.outputs.release-detected == 'true' }}
|
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.release.outputs.tag-name }}
|
tag_name: ${{ steps.release.outputs.tag-name }}
|
||||||
|
@ -113,7 +129,6 @@ jobs:
|
||||||
files: ${{ env.PROJ_NAME }}-*/${{ env.PROJ_NAME }}-*
|
files: ${{ env.PROJ_NAME }}-*/${{ env.PROJ_NAME }}-*
|
||||||
|
|
||||||
- name: Release | Crates.io
|
- name: Release | Crates.io
|
||||||
if: ${{ steps.release.outputs.release-detected == 'true' }}
|
|
||||||
env:
|
env:
|
||||||
RUST_LOG: info
|
RUST_LOG: info
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -23,8 +23,8 @@ impl Version {
|
||||||
let commit = git_description();
|
let commit = git_description();
|
||||||
|
|
||||||
let official_release =
|
let official_release =
|
||||||
std::env::var("FJ_OFFICIAL_RELEASE").as_deref() == Ok("1");
|
std::env::var("RELEASE_DETECTED").as_deref() == Ok("true");
|
||||||
println!("cargo:rerun-if-env-changed=FJ_OFFICIAL_RELEASE");
|
println!("cargo:rerun-if-env-changed=RELEASE_DETECTED");
|
||||||
|
|
||||||
let full_string = match (commit, official_release) {
|
let full_string = match (commit, official_release) {
|
||||||
(Some(commit), true) => format!("{pkg_version} ({commit})"),
|
(Some(commit), true) => format!("{pkg_version} ({commit})"),
|
||||||
|
|
Loading…
Reference in New Issue