Skip to content

Commit

Permalink
Use version numbers in build artifacts, automate release assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-L2L committed Mar 12, 2024
1 parent c42020f commit e1b49ee
Showing 1 changed file with 63 additions and 13 deletions.
76 changes: 63 additions & 13 deletions .github/workflows/check_lint_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
check-lint-build-stable:
name: Check, Lint, Build (ubuntu stable)
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 20
# env:
# RUSTFLAGS: -D warnings
Expand Down Expand Up @@ -48,22 +50,39 @@ jobs:
command: build
args: --release

- name: 'Set environment variables: version number and output filename'
run: |
BITNAMES_APP_VERSION=$(cargo metadata --format-version 1 | \
jq -er '.packages | map(select(.name == "plain_bitnames_app") | .version) | .[0]')
OUTPUT_FILENAME="bitnames-${BITNAMES_APP_VERSION}-x86_64-unknown-linux-gnu"
echo "BITNAMES_APP_VERSION=$BITNAMES_APP_VERSION" >> "$GITHUB_ENV"
echo "OUTPUT_FILENAME=$OUTPUT_FILENAME" >> "$GITHUB_ENV"
- name: 'Set filename for release binary'
run: |
pushd "target/release"
mv "plain_bitnames_app" "bitnames-gui-x86_64-unknown-linux-gnu"
ln -fs "plain_bitnames_app" "${OUTPUT_FILENAME}"
popd
- name: 'Upload Artifacts (bitnames-gui)'
- name: 'Upload Artifacts (bitnames)'
uses: actions/upload-artifact@v2
with:
name: bitnames-gui-x86_64-unknown-linux-gnu
path: target/release/bitnames-gui-x86_64-unknown-linux-gnu
name: ${{ env.OUTPUT_FILENAME }}
path: target/release/${{ env.OUTPUT_FILENAME }}
if-no-files-found: error

- name: Release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/release/${{ env.OUTPUT_FILENAME }}
fail_on_unmatched_files: true

build-macos:
name: Build (macos-x86_64)
runs-on: macos-latest
permissions:
contents: write
timeout-minutes: 20
# env:
# RUSTFLAGS: -D warnings
Expand All @@ -85,22 +104,39 @@ jobs:
command: build
args: --release

- name: 'Set environment variables: version number and output filename'
run: |
BITNAMES_APP_VERSION=$(cargo metadata --format-version 1 | \
jq -er '.packages | map(select(.name == "plain_bitnames_app") | .version) | .[0]')
OUTPUT_FILENAME="bitnames-${BITNAMES_APP_VERSION}-x86_64-apple-darwin"
echo "BITNAMES_APP_VERSION=$BITNAMES_APP_VERSION" >> "$GITHUB_ENV"
echo "OUTPUT_FILENAME=$OUTPUT_FILENAME" >> "$GITHUB_ENV"
- name: 'set filename for release binary'
run: |
pushd "target/release"
mv "plain_bitnames_app" "bitnames-gui-x86_64-apple-darwin"
ln -fs "plain_bitnames_app" "${OUTPUT_FILENAME}"
popd
- name: 'Upload Artifacts (bitnames-gui)'
- name: 'Upload Artifacts (bitnames)'
uses: actions/upload-artifact@v2
with:
name: bitnames-gui-x86_64-apple-darwin
path: target/release/bitnames-gui-x86_64-apple-darwin
name: ${{ env.OUTPUT_FILENAME }}
path: target/release/${{ env.OUTPUT_FILENAME }}
if-no-files-found: error

- name: Release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/release/${{ env.OUTPUT_FILENAME }}
fail_on_unmatched_files: true

build-windows:
name: Build (x86_64-pc-windows-gnu)
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 20
# env:
# RUSTFLAGS: -D warnings
Expand Down Expand Up @@ -128,17 +164,31 @@ jobs:
env:
RUSTFLAGS: "-C linker=/usr/bin/x86_64-w64-mingw32-gcc"

- name: 'Set environment variables: version number and output filename'
run: |
BITNAMES_APP_VERSION=$(cargo metadata --format-version 1 | \
jq -er '.packages | map(select(.name == "plain_bitnames_app") | .version) | .[0]')
OUTPUT_FILENAME="bitnames-${BITNAMES_APP_VERSION}-x86_64-pc-windows-gnu.exe"
echo "BITNAMES_APP_VERSION=$BITNAMES_APP_VERSION" >> "$GITHUB_ENV"
echo "OUTPUT_FILENAME=$OUTPUT_FILENAME" >> "$GITHUB_ENV"
- name: 'set filename for release binary'
run: |
pushd "target/x86_64-pc-windows-gnu/release"
mv "plain_bitnames_app.exe" "bitnames-gui-x86_64-pc-windows-gnu.exe"
ln -fs "plain_bitnames_app.exe" "${OUTPUT_FILENAME}"
popd
- name: 'Upload Artifacts (bitnames-gui)'
- name: 'Upload Artifacts (bitnames)'
uses: actions/upload-artifact@v2
with:
name: bitnames-gui-x86_64-pc-windows-gnu.exe
path: target/x86_64-pc-windows-gnu/release/bitnames-gui-x86_64-pc-windows-gnu.exe
name: ${{ env.OUTPUT_FILENAME }}
path: target/x86_64-pc-windows-gnu/release/${{ env.OUTPUT_FILENAME }}
if-no-files-found: error


- name: Release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/x86_64-pc-windows-gnu/release/${{ env.OUTPUT_FILENAME }}
fail_on_unmatched_files: true

0 comments on commit e1b49ee

Please sign in to comment.