-
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.
feat(ci) add ci to publish to crates.io
- Loading branch information
Showing
2 changed files
with
82 additions
and
13 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,79 @@ | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
name: publish cargo | ||
|
||
jobs: | ||
audit: | ||
name: Audit | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: rustsec/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build_and_test_linux: | ||
name: Build and Test (Linux) | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
|
||
- uses: taiki-e/install-action@nextest | ||
- name: 'Build and test' | ||
run: cargo nextest run --workspace --all-targets --all-features | ||
|
||
|
||
build_and_test_macos: | ||
name: Build and Test (MacOS) | ||
runs-on: macos-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
|
||
- uses: taiki-e/install-action@nextest | ||
- name: 'Build and test' | ||
run: cargo nextest run --workspace --all-targets --all-features | ||
|
||
crates_io_publish: | ||
name: Publish (crates.io) | ||
needs: | ||
- audit | ||
- build_and_test_linux | ||
- build_and_test_macos | ||
|
||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: cargo-release Cache | ||
id: cargo_release_cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cargo/bin/cargo-release | ||
key: ${{ runner.os }}-cargo-release | ||
|
||
- run: cargo install cargo-release | ||
if: steps.cargo_release_cache.outputs.cache-hit != 'true' | ||
|
||
- name: cargo login | ||
run: cargo login ${{ secrets.CARGO_API_TOKEN }} | ||
|
||
- name: "cargo release publish" | ||
run: |- | ||
cargo release \ | ||
publish \ | ||
--workspace \ | ||
--all-features \ | ||
--allow-branch main \ | ||
--no-confirm \ | ||
--execute |
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,15 +1,10 @@ | ||
name: auto-release | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 */14 * *' # Runs every 14 days at midnight UTC | ||
workflow_dispatch: | ||
# NOTE: Depcrated pipeline, here for reference | ||
name: multi-build | ||
|
||
jobs: | ||
create-tag-release: | ||
runs-on: ${{ matrix.runner }} | ||
|
||
# Define the build matrix for cross-compilation | ||
strategy: | ||
matrix: | ||
include: | ||
|
@@ -62,30 +57,25 @@ jobs: | |
BIN_SUFFIX=".exe" | ||
fi | ||
# The built binary output location | ||
BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}" | ||
|
||
# Define a better name for the final binary | ||
BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}" | ||
BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}" | ||
|
||
# Move the built binary where you want it | ||
# mv "${BIN_OUTPUT}" "./<your-destination>/${BIN_RELEASE}" | ||
mv "${BIN_OUTPUT}" "./<your-destination>/${BIN_RELEASE}" | ||
|
||
- name: Compress artifacts | ||
run: | | ||
mkdir -p artifacts | ||
tar -czvf artifacts/${{ matrix.target }}-build_artifacts.tar.gz -C target/${{ matrix.target }}/release . | ||
# Step 7: Create the new tag | ||
- name: Create new tag | ||
run: | | ||
git config user.name "github-actions" | ||
git config user.email "[email protected]" | ||
git tag ${{ env.NEW_VERSION }} | ||
git push origin ${{ env.NEW_VERSION }} | ||
# Step 8: Upload the release artifacts for this architecture | ||
- name: Create GitHub Release and Upload Artifacts | ||
uses: actions/create-release@v1 | ||
env: | ||
|