This repository has been archived by the owner on Aug 24, 2024. It is now read-only.
fix: only build aether-core #3
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
name: Release | ||
on: | ||
push: | ||
tags: | ||
- 'aether-core@v*' | ||
env: | ||
# name of the main binary | ||
binary: aether | ||
RUST_VERSION_NIGHTLY: nightly-2024-06-22 | ||
RELEASE_BODY: | | ||
_This is an automated generated release by github actions._ | ||
## Binaries Available | ||
* Linux (x86_64) | ||
* Windows (x86_64-pc-windows-msvc) | ||
* MacOS (Silicon) | ||
_Other OS/Platform doesn't comes with this release and you need to build it manually. refer to [BUILD.md](https://github.com/AS1100K/aether/blob/main/BUILD.md)_ | ||
jobs: | ||
# Build for Linux | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
pre_release: ${{ steps.pre_release_check.outputs.PRERELEASE }} | ||
release_name: ${{ steps.release_name.outputs.RELEASENAME }} | ||
steps: | ||
- uses: olegtarasov/get-tag@v2.1.3 | ||
id: get_version | ||
with: | ||
tagRegex: "aether-core@(?<version>v\d+\.\d+\.\d+)-(?<prerelease>(alpha|beta|rc)\.\d+)" | ||
- name: pre-release check | ||
id: pre_release_check | ||
run: | | ||
echo "PRERELEASE=${{ steps.get_version.outputs.prerelease == '' }}" >> "GITHUB_OUTPUT" | ||
- name: release name generation | ||
id: release_name | ||
run: | | ||
echo "RELEASENAME=${{ format('{Aether Core {0} {1} }', steps.get_version.outputs.version, steps.get_version.outputs.prerelease) }}" >> "GITHUB_OUTPUT" | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
targets: x86_64-unknown-linux-gnu | ||
toolchain: ${{ env.RUST_VERSION_NIGHTLY }} | ||
- name: install dependencies | ||
run: | | ||
sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev | ||
- name: Build | ||
run: | | ||
cd aether-core | ||
cargo build --release --target x86_64-unknown-linux-gnu | ||
cd ../ | ||
- name: Prepare package | ||
run: | | ||
mkdir linux | ||
cp target/x86_64-unknown-linux-gnu/release/${{ env.binary }} linux/ | ||
- name: Package as a zip | ||
working-directory: ./linux | ||
run: | | ||
zip --recurse-paths ../${{ env.binary }}.zip . | ||
- name: Upload binaries to artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: ${{ env.binary }}.zip | ||
name: linux | ||
retention-days: 1 | ||
# Build for Windows | ||
build-windows: | ||
runs-on: windows-latest | ||
needs: build-linux | ||
steps: | ||
- env: | ||
PRERELEASE: ${{needs.build-linux.outputs.pre_release}} | ||
RELEASENAME: ${{needs.build-linux.outputs.release_name}} | ||
run: | | ||
echo "$PRERELEASE $RELEASENAME" | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
targets: x86_64-pc-windows-msvc | ||
toolchain: ${{ env.RUST_VERSION_NIGHTLY }} | ||
- name: Build | ||
run: | | ||
cd aether-core | ||
cargo build --release --target x86_64-pc-windows-msvc | ||
cd ../ | ||
- name: Prepare package | ||
run: | | ||
mkdir windows | ||
cp target/x86_64-pc-windows-msvc/release/${{ env.binary }}.exe windows/ | ||
- name: Package as a zip | ||
run: | | ||
Compress-Archive -Path windows/* -DestinationPath ${{ env.binary }}.zip | ||
- name: Upload binaries to artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: ${{ env.binary }}.zip | ||
name: windows | ||
retention-days: 1 | ||
# Build for MacOS Apple Silicon | ||
build-macOS-apple-silicon: | ||
runs-on: macOS-latest | ||
needs: build-linux | ||
steps: | ||
- env: | ||
PRERELEASE: ${{needs.build-linux.outputs.pre_release}} | ||
RELEASENAME: ${{needs.build-linux.outputs.release_name}} | ||
run: | | ||
echo "$PRERELEASE $RELEASENAME" | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
targets: aarch64-apple-darwin | ||
toolchain: ${{ env.RUST_VERSION_NIGHTLY }} | ||
- name: Environment | ||
# macOS 11 was the first version to support ARM | ||
run: | | ||
export MACOSX_DEPLOYMENT_TARGET="11" | ||
- name: Build | ||
run: | | ||
cd aether-core | ||
cargo build --release --target aarch64-apple-darwin | ||
cd ../ | ||
- name: Prepare Package | ||
run: | | ||
mkdir -p ${{ env.binary }}.app/Contents/MacOS | ||
cp target/aarch64-apple-darwin/release/${{ env.binary }} ${{ env.binary }}.app/Contents/MacOS/ | ||
hdiutil create -fs HFS+ -volname "${{ env.binary }}-macOS-apple-silicon" -srcfolder ${{ env.binary }}.app ${{ env.binary }}-macOS-apple-silicon.dmg | ||
- name: Upload binaries to artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: ${{ env.binary }}-macOS-apple-silicon.dmg | ||
name: macOS-apple-silicon | ||
retention-days: 1 | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: [ "build-linux", "build-windows", "build-macOS-apple-silicon"] | ||
steps: | ||
- env: | ||
PRERELEASE: ${{needs.build-linux.outputs.pre_release}} | ||
RELEASENAME: ${{needs.build-linux.outputs.release_name}} | ||
run: | | ||
echo "$PRERELEASE $RELEASENAME" | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v4 | ||
- name: Upload linux binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: linux.zip | ||
asset_name: ${{ env.binary }}-windows-${{ env.RELEASENAME }}.zip | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
- name: Upload macOS-apple-silicon binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: macOS-apple-silicon.zip | ||
asset_name: ${{ env.binary }}-macOS-apple-silicon-${{ env.RELEASENAME }}.zip | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
- name: Upload windows binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: windows.zip | ||
asset_name: ${{ env.binary }}-linux-${{ env.RELEASENAME }}.zip | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
- name: Release Notes | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
body: ${{ env.RELEASE_BODY }} | ||
prerelease: ${{ env.PRERELEASE }} | ||
release_name: ${{ env.PRERELEASE }} | ||
make_latest: ${{ !env.PRERELEASE }} |