Skip to content

Commit

Permalink
Merge pull request #32
Browse files Browse the repository at this point in the history
Introduces some tweaks to this project: 1) Adhere Keep a Changelog to
track release notes. 2) Refine development environment management.
Specifically, bring `rust-toolchain.toml` back to force the Rust
toolchain for development, and reduce Nix flake package dependencies.
  • Loading branch information
loichyan authored Nov 22, 2024
2 parents c31f36a + 8612bd6 commit 5682812
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 192 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.sh]
indent_style = tab
20 changes: 10 additions & 10 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ jobs:
name: ${{ needs.metadata.outputs.name }}-${{ matrix.target }}
path: ${{ steps.pack.outputs.name }}*

# How to create a new GitHub release?
# 1. Create a release branch named "release/<tag>".
# 2. Open a PR from the branch, including the release note in the PR body.
# 3. Wait for the CI to create a draft release.
# 4. Publish the release when it's ready.
release:
name: Create GitHub release
needs: [metadata, build]
Expand All @@ -179,10 +184,6 @@ jobs:
contents: write # need to update release
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v4

# For a PR from "release/v1.0.0", the release tag is set to "v1.0.0"
- name: Setup | Configure
id: configure
run: echo tag="${GITHUB_HEAD_REF#release/}" >$GITHUB_OUTPUT
Expand All @@ -194,24 +195,23 @@ jobs:
pattern: ${{ needs.metadata.outputs.name }}-*
merge-multiple: true

# Release notes are taken from the PR's body
- name: Release | Create Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release_tag: ${{ steps.configure.outputs.tag }}
release_body: ${{ github.event.pull_request.body }}
run: |
if gh release view --json= "$release_tag" &>/dev/null; then
echo "update existed release $release_tag"
command=edit
if gh release view "$release_tag" &>/dev/null; then
echo "update existing release $release_tag"
command="edit"
else
echo "create new release $release_tag"
command=create
command="create"
fi
gh release "$command" "$release_tag" \
--target="$GITHUB_BASE_REF" \
--draft=true \
--title="$release_tag ($(date -u +'%Y-%m-%d'))" \
--title="${release_tag#v} ($(date -u +'%Y-%m-%d'))" \
--notes="$release_body"
- name: Release | Upload artifacts
Expand Down
13 changes: 13 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail
if command -v nix &>/dev/null; then
nix develop .#msrv --command cargo check
fi
if command -v cargo &>/dev/null; then
if command -v cargo-clippy &>/dev/null; then
cargo clippy
else
cargo check
fi
cargo test
fi
Loading

0 comments on commit 5682812

Please sign in to comment.