-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 changed file
with
68 additions
and
15 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 |
---|---|---|
@@ -1,22 +1,75 @@ | ||
name: "Release binaries" | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [created] | ||
push: | ||
tags: | ||
- "[0-9]+.[0-9]+.[0-9]+" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
name: release ${{ matrix.target }} | ||
runs-on: ubuntu-latest | ||
build-and-upload: | ||
name: Build and upload | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: [x86_64-unknown-linux-musl] | ||
include: | ||
- build: linux | ||
os: ubuntu-latest | ||
target: x86_64-unknown-linux-musl | ||
|
||
# - build: macos | ||
# os: macos-latest | ||
# target: x86_64-apple-darwin | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Compile and release | ||
uses: rust-build/rust-build.action@v1.4.4 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get the release version from tag | ||
shell: bash | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
|
||
- name: Install Rust | ||
# Or @nightly if you want | ||
uses: dtolnay/rust-toolchain@stable | ||
# Arguments to pass in | ||
with: | ||
# Make Rust compile to our target (defined in the matrix) | ||
targets: ${{ matrix.target }} | ||
|
||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: true | ||
command: build | ||
args: --verbose --release --target ${{ matrix.target }} | ||
|
||
- name: Build archive | ||
shell: bash | ||
run: | | ||
# Replace with the name of your binary | ||
server_binary="decay" | ||
gha_binary="decay_gha" | ||
dirname="$server_binary-${{ env.VERSION }}-${{ matrix.target }}" | ||
mkdir "$dirname" | ||
mv "target/${{ matrix.target }}/release/$server_binary" "$dirname" | ||
tar -czf "$dirname.tar.gz" "$dirname" | ||
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV | ||
dirname="$gha_binary-${{ env.VERSION }}-${{ matrix.target }}" | ||
mkdir "$dirname" | ||
mv "target/${{ matrix.target }}/release/$gha_binary" "$dirname" | ||
tar -czf "$dirname.tar.gz" "$dirname" | ||
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
RUSTTARGET: ${{ matrix.target }} | ||
EXTRA_FILES: "README.md LICENSE" | ||
files: | | ||
${{ env.ASSET }} |