-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #504 from slowsage/ci/binary
ci: Build binaries on new tag.
- Loading branch information
Showing
5 changed files
with
72 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
|
||
# sudo needed for github runner, not available by default for cross images | ||
if command -v sudo >/dev/null 2>&1; then | ||
SUDO="sudo" | ||
else | ||
SUDO="" | ||
fi | ||
|
||
# Needed for cross-compilation | ||
if [ -n "$CROSS_DEB_ARCH" ]; then | ||
$SUDO dpkg --add-architecture "$CROSS_DEB_ARCH" | ||
fi | ||
|
||
# CROSS_DEB_ARCH is empty for native builds | ||
$SUDO apt-get update && $SUDO apt-get install --assume-yes \ | ||
libssl-dev${CROSS_DEB_ARCH:+:$CROSS_DEB_ARCH} \ | ||
libgtk-3-dev${CROSS_DEB_ARCH:+:$CROSS_DEB_ARCH} \ | ||
libgtk-layer-shell-dev${CROSS_DEB_ARCH:+:$CROSS_DEB_ARCH} \ | ||
libpulse-dev${CROSS_DEB_ARCH:+:$CROSS_DEB_ARCH} |
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,39 @@ | ||
# .github/workflows/binary.yml | ||
|
||
name: Binary | ||
on: | ||
release: | ||
types: [created] | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- {target: x86_64-unknown-linux-gnu, zipext: ".tar.gz"} | ||
- {target: aarch64-unknown-linux-gnu, zipext: ".tar.gz"} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cross | ||
|
||
- name: Add OpenSSL crate (vendored) | ||
run: cargo add openssl --features vendored | ||
|
||
- name: Cross Build Release | ||
run: cross build --locked --release --target=${{ matrix.platform.target }} | ||
|
||
- name: Get name of Binary from metadata | ||
run: echo "BINARY_NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].targets[] | select( .kind | map(. == "bin") | any ) | .name')" >> $GITHUB_ENV | ||
|
||
- name: Compress the built binary | ||
if: ${{ matrix.platform.zipext == '.tar.gz' }} | ||
run: tar -zcvf ${{env.BINARY_NAME}}-${{github.ref_name}}-${{matrix.platform.target}}.tar.gz -C target/${{matrix.platform.target}}/release ${{env.BINARY_NAME}} | ||
|
||
- name: Upload to release | ||
run: gh release upload ${GITHUB_REF#refs/*/} ${{env.BINARY_NAME}}-${{github.ref_name}}-${{matrix.platform.target}}${{matrix.platform.zipext}} | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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,7 @@ | ||
[build] | ||
pre-build = "./.github/scripts/ubuntu_setup.sh" | ||
[target.aarch64-unknown-linux-gnu] | ||
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" | ||
|
||
[target.x86_64-unknown-linux-gnu] | ||
image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main" |