-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
125 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# inspired by https://github.com/shssoichiro/oxipng/blob/15ecc9ed00199f1fbfe0989d67a43ff3e6faff6a/.github/workflows/deploy.yml | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
permissions: | ||
actions: read | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
name: release | ||
|
||
runs-on: ubuntu-latest | ||
|
||
# Prevent job from running on forks | ||
if: ${{ !github.event.repository.fork }} | ||
|
||
strategy: | ||
matrix: | ||
platform: | ||
- target: x86_64-unknown-linux-gnu | ||
name: linux-x86_64 | ||
- target: aarch64-unknown-linux-gnu | ||
name: linux-aarch64 | ||
- target: x86_64-pc-windows-msvc | ||
name: windows-x86_64 | ||
- target: i686-pc-windows-msvc | ||
name: windows-i686 | ||
- target: x86_64-apple-darwin | ||
name: macos-x86_64 | ||
- target: aarch64-apple-darwin | ||
name: macos-aarch64 | ||
|
||
env: | ||
PROJECT_NAME: autocrap | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
|
||
- name: get version | ||
id: meta | ||
run: | | ||
version=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "'"$PROJECT_NAME"'").version') | ||
echo "version=$version" >> "$GITHUB_OUTPUT" | ||
- name: retrieve ${{ matrix.platform.target }} binary | ||
uses: dawidd6/action-download-artifact@v6 | ||
with: | ||
workflow: build.yml | ||
commit: ${{ env.GITHUB_SHA }} | ||
name: ${{ env.PROJECT_NAME }}-${{ matrix.platform.target }} | ||
path: target | ||
|
||
- name: build archives | ||
working-directory: target | ||
run: | | ||
ARCHIVE_NAME='${{ env.PROJECT_NAME }}-${{ steps.meta.outputs.version }}-${{ matrix.platform.name }}' | ||
echo "ARCHIVE_NAME=$ARCHIVE_NAME" | ||
mkdir "$ARCHIVE_NAME" | ||
case '${{ matrix.platform.target }}' in | ||
*-windows-*) | ||
cp -a "${PROJECT_NAME}.exe" "$ARCHIVE_NAME" | ||
zip "${ARCHIVE_NAME}.zip" "$ARCHIVE_NAME"/* | ||
;; | ||
*) | ||
cp -a "$PROJECT_NAME" "$ARCHIVE_NAME" | ||
# fix permissions https://github.com/actions/toolkit/issues/1722 | ||
chmod ugo+x "$ARCHIVE_NAME"/"$PROJECT_NAME" | ||
tar czvf "${ARCHIVE_NAME}.tar.gz" "$ARCHIVE_NAME"/* | ||
;; | ||
esac | ||
- name: create release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
name: v${{ steps.meta.outputs.version }} | ||
# body_path: RELEASE_NOTES.txt | ||
files: | | ||
target/*.zip | ||
target/*.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[target.x86_64-unknown-linux-gnu] | ||
pre-build = [ | ||
"export PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu=/usr/lib/x86_64-linux-gnu/pkgconfig", | ||
"dpkg --add-architecture $CROSS_DEB_ARCH", | ||
"apt-get update && apt-get install --assume-yes libasound2-dev:$CROSS_DEB_ARCH" | ||
] | ||
|
||
[target.aarch64-unknown-linux-gnu] | ||
pre-build = [ | ||
"export PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu=/usr/lib/aarch64-linux-gnu/pkgconfig", | ||
"dpkg --add-architecture $CROSS_DEB_ARCH", | ||
"apt-get update && apt-get install --assume-yes libasound2-dev:$CROSS_DEB_ARCH" | ||
] |