-
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.
fix: github CI workflows for release and PR checks (#2)
- Loading branch information
Showing
6 changed files
with
150 additions
and
8 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,30 @@ | ||
name: Compile artifacts for target release | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
release: | ||
name: release ${{ matrix.target }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- target: x86_64-pc-windows-gnu | ||
archive: zip | ||
- target: x86_64-unknown-linux-musl | ||
archive: tar.gz tar.xz tar.zst | ||
- target: x86_64-apple-darwin | ||
archive: zip | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Compile and release | ||
uses: rust-build/rust-build.action@v1.4.3 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
RUSTTARGET: ${{ matrix.target }} | ||
ARCHIVE_TYPES: ${{ matrix.archive }} |
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,60 @@ | ||
name: Pull request prechecks | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
precheck: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 0 | ||
|
||
- name: Install Stable | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Toolchain Info | ||
run: | | ||
rustup 1.25.2 --version | ||
cargo --version --verbose | ||
rustc --version | ||
cargo clippy --version | ||
- name: Conventional Commits | ||
run: | | ||
cargo install --locked cocogitto | ||
cog check --from-latest-tag | ||
- name: Lint | ||
run: | | ||
cargo fmt --check | ||
cargo clippy | ||
- name: Test | ||
run: | | ||
cargo check --locked | ||
cargo test | ||
build: | ||
needs: precheck | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Stable | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
||
- name: Build Default Target | ||
run: | | ||
cargo build --release |
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,58 @@ | ||
name: Bump version and release | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install Stable Minimal | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
|
||
- name: Git User Setup | ||
run: | | ||
git config --global user.name "${GITHUB_ACTOR}" | ||
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
- name: Conventional Commits | ||
run: | | ||
cargo install --locked cocogitto | ||
cog check --from-latest-tag | ||
- name: Bump Package Version | ||
run: | | ||
cog bump --auto || exit 0 | ||
- name: Update Cargo.toml Version | ||
id: versioning | ||
run: | | ||
version=$(git describe --tags "$(git rev-list --tags --max-count=1)") | ||
echo "version=$version" >> "$GITHUB_OUTPUT" | ||
sed -ri "s/version = \"(([0-9]+\.)*[0-9]+)\"/version = \"$version\"/" Cargo.toml | ||
git add Cargo.toml | ||
git commit --amend --no-edit | ||
- name: Push | ||
run: | | ||
git push origin --tags | ||
git push origin | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body_path: CHANGELOG.md | ||
draft: false | ||
prerelease: false | ||
tag_name: ${{ steps.versioning.outputs.version }} | ||
token: ${{ secrets.PAT }} |
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,3 +1,4 @@ | ||
/target | ||
Cargo.lock | ||
.vscode | ||
.DS_Store |
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,5 +1,3 @@ | ||
tag_prefix = "v" | ||
|
||
[changelog] | ||
template = "remote" | ||
remote = "github.com" | ||
|
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