-
Notifications
You must be signed in to change notification settings - Fork 15
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
128 additions
and
123 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 |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
branches: | ||
- master | ||
tags: | ||
- '*' | ||
- "*" | ||
|
||
jobs: | ||
build: | ||
|
@@ -22,116 +22,121 @@ jobs: | |
os: mac | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ matrix.runs-on }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Set up Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Build | ||
run: cargo build --release | ||
|
||
- name: Prepare artifacts | ||
shell: bash | ||
run: |- | ||
mkdir dist | ||
for file in autokuma autokuma.exe kuma kuma.exe; do | ||
if [[ ! -e "target/release/$file" ]]; then | ||
continue | ||
fi | ||
filename=$(basename "$file") | ||
if [[ "$filename" == *.* ]]; then | ||
extension=".${filename##*.}" | ||
filename="${filename%.*}" | ||
else | ||
extension="" | ||
fi | ||
mv "target/release/${filename}${extension}" "dist/${filename}-${{ matrix.os }}${extension}" | ||
done | ||
- name: Archive artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: autokuma-${{ matrix.os }} | ||
path: dist/* | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ matrix.runs-on }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Set up Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Setup NASM | ||
if: matrix.os == 'windows' | ||
run: | | ||
choco install nasm -y | ||
refreshenv | ||
- name: Build | ||
run: cargo build --release | ||
|
||
- name: Prepare artifacts | ||
shell: bash | ||
run: |- | ||
mkdir dist | ||
for file in autokuma autokuma.exe kuma kuma.exe; do | ||
if [[ ! -e "target/release/$file" ]]; then | ||
continue | ||
fi | ||
filename=$(basename "$file") | ||
if [[ "$filename" == *.* ]]; then | ||
extension=".${filename##*.}" | ||
filename="${filename%.*}" | ||
else | ||
extension="" | ||
fi | ||
mv "target/release/${filename}${extension}" "dist/${filename}-${{ matrix.os }}${extension}" | ||
done | ||
- name: Archive artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: autokuma-${{ matrix.os }} | ||
path: dist/* | ||
|
||
github-release: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install cargo-release | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-release | ||
|
||
- name: Parse Changelog | ||
id: changelog | ||
uses: coditory/changelog-parser@v1 | ||
|
||
- name: Download All Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist | ||
pattern: autokuma-* | ||
merge-multiple: true | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Release ${{ github.ref_name }} | ||
body: ${{ steps.changelog.outputs.description }} | ||
files: dist/* | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install cargo-release | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-release | ||
|
||
- name: Parse Changelog | ||
id: changelog | ||
uses: coditory/changelog-parser@v1 | ||
|
||
- name: Download All Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist | ||
pattern: autokuma-* | ||
merge-multiple: true | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: Release ${{ github.ref_name }} | ||
body: ${{ steps.changelog.outputs.description }} | ||
files: dist/* | ||
|
||
crates-io: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install tools | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-release,markdown-extract | ||
|
||
- name: setup git | ||
shell: bash | ||
run: |- | ||
git config user.email "[email protected]" | ||
git config user.name "Github Runner" | ||
- name: Publish to crates.io | ||
shell: bash | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
run: cargo release --workspace --execute --no-confirm "${GITHUB_REF_NAME#v}" | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install tools | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-release,markdown-extract | ||
|
||
- name: setup git | ||
shell: bash | ||
run: |- | ||
git config user.email "[email protected]" | ||
git config user.name "Github Runner" | ||
- name: Publish to crates.io | ||
shell: bash | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
run: cargo release --workspace --execute --no-confirm "${GITHUB_REF_NAME#v}" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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