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 08333c3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 15 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
42 changes: 34 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,19 @@ jobs:
exit 1
fi
- name: Generate a changelog
uses: orhun/git-cliff-action@v3
with:
config: cliff.toml
args: --verbose --unreleased --strip header
env:
OUTPUT: CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}

- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create $VERSION --draft --verify-tag --title $VERSION
run: gh release create $VERSION --draft --verify-tag --notes-file CHANGELOG.md --title $VERSION

outputs:
version: ${{ env.VERSION }}
Expand All @@ -66,11 +75,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 +114,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 +142,22 @@ 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: macos-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
--no-verify
--token ${{ secrets.CARGO_REGISTRY_TOKEN }}
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vaultwalker"
version = "0.4.0"
version = "0.4.1"
authors = ["Pierre Millot <millotpierre3@gmail.com>"]
license = "MIT"
description = "A CLI tool to browse Hashicorp Vault secrets"
Expand Down

0 comments on commit 08333c3

Please sign in to comment.