-
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
2 changed files
with
91 additions
and
5 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,75 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build-for-macos: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Add targets | ||
run: | | ||
rustup target add aarch64-apple-darwin | ||
rustup target add x86_64-apple-darwin | ||
- name: Build | ||
run: cargo build --release --target x86_64-apple-darwin --target aarch64-apple-darwin | ||
- name: Run tests | ||
run: cargo test | ||
- name: Set env | ||
run: | | ||
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
echo "BIN_NAME=$(cat Cargo.toml | grep name | sed -E 's/.*"(.*)".*/\1/')" >> $GITHUB_ENV | ||
- name: Zip artifacts | ||
run: | | ||
mkdir -p artifacts/ | ||
pushd artifacts | ||
echo zip ${BIN_NAME}-${RELEASE_VERSION}-x86_64-apple-darwin.zip ../target/x86_64-apple-darwin/release/${BIN_NAME} | ||
zip -j ${BIN_NAME}-${RELEASE_VERSION}-x86_64-apple-darwin.zip ../target/x86_64-apple-darwin/release/${BIN_NAME} | ||
echo zip ${BIN_NAME}-${RELEASE_VERSION}-aarch64-apple-darwin.zip ../target/aarch64-apple-darwin/release/${BIN_NAME} | ||
zip -j ${BIN_NAME}-${RELEASE_VERSION}-aarch64-apple-darwin.zip ../target/aarch64-apple-darwin/release/${BIN_NAME} | ||
popd | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: macos-binaries | ||
path: artifacts/*.zip | ||
build-for-linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Add targets | ||
run: rustup target add x86_64-unknown-linux-musl | ||
- name: Build | ||
run: cargo build --release --target x86_64-unknown-linux-musl | ||
- name: Run tests | ||
run: cargo test | ||
- name: Set env | ||
run: | | ||
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
echo "BIN_NAME=$(cat Cargo.toml | grep name | sed -E 's/.*"(.*)".*/\1/')" >> $GITHUB_ENV | ||
- name: Zip artifacts | ||
run: | | ||
mkdir -p artifacts/ | ||
pushd artifacts | ||
echo zip ${BIN_NAME}-${RELEASE_VERSION}-x86_64-unknown-linux-musl.zip ../target/x86_64-unknown-linux-musl/release/${BIN_NAME} | ||
zip -j ${BIN_NAME}-${RELEASE_VERSION}-x86_64-unknown-linux-musl.zip ../target/x86_64-unknown-linux-musl/release/${BIN_NAME} | ||
popd | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: linux-binaries | ||
path: artifacts/*.zip | ||
release: | ||
needs: [build-for-macos, build-for-linux] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
path: artifacts/ | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "artifacts/**/*.zip" | ||
|
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