-
Notifications
You must be signed in to change notification settings - Fork 0
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 #24 from apimeister/release-pipe
implement release pipeline
- Loading branch information
Showing
3 changed files
with
131 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
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,107 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
jobs: | ||
create-winlinux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
~/.rustup | ||
/usr/local/cargo | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Install Rust | ||
run: rustup update stable | ||
- name: Run rustfmt | ||
run: cargo fmt --all -- --check | ||
- name: Run clippy | ||
run: cargo clippy --all-targets -- -D warnings | ||
- uses: taiki-e/install-action@nextest | ||
- name: Cargo Test | ||
run: cargo nextest run --no-fail-fast | ||
- name: Install Targets | ||
run: | | ||
rustup target add x86_64-pc-windows-gnu x86_64-unknown-linux-musl | ||
sudo apt install -y musl-tools gcc-mingw-w64 | ||
- name: Compile | ||
run: | | ||
cargo build --release --target x86_64-pc-windows-gnu | ||
cargo build --release --target x86_64-unknown-linux-musl | ||
- name: Pack | ||
working-directory: target | ||
run: | | ||
tar -czvf unpatched-agent_x86_64-unknown-linux-musl.tar.gz ../README.md ../LICENSE -C x86_64-unknown-linux-musl/release unpatched-agent | ||
zip -jv unpatched-agent_x86_64-pc-windows-gnu.zip x86_64-pc-windows-gnu/release/unpatched-agent.exe ../README.md ../LICENSE | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: winlinux | ||
path: | | ||
target/unpatched-agent_x86_64-unknown-linux-musl.tar.gz | ||
target/unpatched-agent_x86_64-pc-windows-gnu.zip | ||
if-no-files-found: error | ||
create-mac: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
~/.rustup | ||
/usr/local/cargo | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Install Rust | ||
run: rustup update stable | ||
- name: Run rustfmt | ||
run: cargo fmt --all -- --check | ||
- name: Run clippy | ||
run: cargo clippy --all-targets -- -D warnings | ||
- uses: taiki-e/install-action@nextest | ||
- name: Cargo Test | ||
run: cargo nextest run --no-fail-fast | ||
- name: Compile | ||
run: cargo build --release | ||
- name: Pack | ||
working-directory: target | ||
run: zip -jv unpatched-agent_x86_64-apple-darwin.zip release/unpatched-agent ../README.md ../LICENSE | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: mac | ||
path: target/unpatched-agent_x86_64-apple-darwin.zip | ||
if-no-files-found: error | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: ["create-winlinux", "create-mac"] | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: winlinux | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: mac | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
generate_release_notes: true | ||
files: | | ||
unpatched-agent_x86_64-unknown-linux-musl.tar.gz | ||
unpatched-agent_x86_64-apple-darwin.zip | ||
unpatched-agent_x86_64-pc-windows-gnu.zip |