-
Notifications
You must be signed in to change notification settings - Fork 312
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
73 additions
and
79 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,107 +1,78 @@ | ||
name: Make Distribution | ||
|
||
name: Build Releases | ||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- "*" | ||
release: | ||
types: [published] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
AUTH_SERVER_IP: ${{ secrets.AUTH_SERVER_IP }} | ||
|
||
|
||
jobs: | ||
make_dist: | ||
name: Make Distribution File(${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }}-latest | ||
name: Build Release on (${{ matrix.platform }}) | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: windows | ||
filetag: win-x86_64 | ||
- os: ubuntu | ||
filetag: linux-x86_64 | ||
- os: macos | ||
filetag: macos-x86_64 | ||
platform: [macos-latest, ubuntu-20.04, windows-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- uses: pnpm/action-setup@v2 | ||
name: Install pnpm | ||
id: pnpm-install | ||
with: | ||
version: 7 | ||
run_install: false | ||
|
||
- name: Get pnpm store directory | ||
id: pnpm-cache | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: | | ||
mkdir dist | ||
pushd frontend | ||
pnpm install && pnpm build | ||
popd | ||
- name: Make executable | ||
make frontend_preinstall | ||
- name: Build dist | ||
run: | | ||
cargo build --release -p zlib-searcher | ||
- name: Make dist(MacOS) | ||
if: matrix.os == 'macos' | ||
make frontend | ||
- name: Build on Linux | ||
if: matrix.platform == 'ubuntu-20.04' | ||
run: | | ||
cp target/release/zlib-searcher . | ||
zip zlib-searcher-macos.zip zlib-searcher && cp zlib-searcher-macos.zip dist/ | ||
- name: Make dist(Windows) | ||
if: matrix.os == 'windows' | ||
cargo install cross | ||
make releases | ||
- name: Build on MacOS | ||
if: matrix.platform == 'macos-latest' | ||
run: | | ||
cp target/release/zlib-searcher.exe . | ||
Compress-Archive -Path zlib-searcher.exe -DestinationPath dist/zlib-searcher-windows.zip | ||
- name: Make dist(Linux) | ||
if: matrix.os == 'ubuntu' | ||
mkdir -p target/dist | ||
rustup target add x86_64-apple-darwin | ||
cargo build --release --target x86_64-apple-darwin -p zlib-searcher | ||
cd target/x86_64-apple-darwin/release && zip zlib-searcher-x86_64-apple-darwin.zip zlib-searcher && cp zlib-searcher-x86_64-apple-darwin.zip ../../dist/ && cd ../../../ | ||
rustup target add aarch64-apple-darwin | ||
cargo build --release --target aarch64-apple-darwin -p zlib-searcher | ||
cd target/aarch64-apple-darwin/release && zip zlib-searcher-aarch64-apple-darwin.zip zlib-searcher && cp zlib-searcher-aarch64-apple-darwin.zip ../../dist/ && cd ../../../ | ||
- name: Build on Windows | ||
if: matrix.platform == 'windows-latest' | ||
run: | | ||
cp target/release/zlib-searcher . | ||
zip zlib-searcher-linux.zip zlib-searcher && cp zlib-searcher-linux.zip dist/ | ||
- name: Archive Distribution Files | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: dist | ||
path: dist/* | ||
|
||
create_release: | ||
name: Create GitHub Release | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: make_dist | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Get Dists | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
- name: Create GitHub Release | ||
mkdir -p target/dist | ||
rustup target add x86_64-pc-windows-msvc | ||
cargo build --release --target x86_64-pc-windows-msvc -p zlib-searcher | ||
cd target/x86_64-pc-windows-msvc/release && Compress-Archive -Path zlib-searcher.exe -DestinationPath zlib-searcher-x86_64-pc-windows-msvc.zip && cp zlib-searcher-x86_64-pc-windows-msvc.zip ../../dist/ && cd ../../../ | ||
- name: Upload Github Assets | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
files: dist/* | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
files: target/dist/* | ||
prerelease: ${{ contains(github.ref, '-') }} |
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 |
---|---|---|
|
@@ -22,3 +22,6 @@ endif | |
clean: | ||
cargo clean | ||
rm -rf release | ||
|
||
releases: | ||
cd scripts && ./build_release.sh -a a |
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