Skip to content

Commit

Permalink
chore(ci): add cache and release to crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp committed May 27, 2024
1 parent 7b8e3b6 commit 6133836
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ jobs:
os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: Install dependencies for ubuntu
if: matrix.os == 'ubuntu-latest'
Expand Down
30 changes: 23 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@ jobs:
os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: Install dependencies for ubuntu
if: matrix.os == 'ubuntu-latest'
Expand Down Expand Up @@ -107,9 +105,9 @@ jobs:
- name: Creating directory for archive
shell: bash
run: |
mkdir -p "$ARCHIVE"/complete
mkdir -p "$ARCHIVE"
cp "$BIN" "$ARCHIVE"/
cp {README.md,LICENSE} "$ARCHIVE"/
cp {README.md,LICENSE,CHANGELOG.md} "$ARCHIVE"/
- name: Build archive (Windows)
shell: bash
Expand All @@ -135,3 +133,21 @@ jobs:
shell: bash
run: |
gh release upload "${{ needs.create-release.outputs.version }}" ${{ env.ASSET }} ${{ env.ASSET_SUM }}
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: build-release
environment: crates.io
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: Publish
# https://doc.rust-lang.org/cargo/reference/config.html?highlight=CARGO_REGISTRY_TOKEN#credentials
run: >
cargo publish
--verbose
--locked
--token ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 comments on commit 6133836

Please sign in to comment.