Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout repository
run: |
rm -rf .git
git init .
git remote add origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git"
git fetch --depth=1 origin "${{ github.sha }}"
git checkout --detach FETCH_HEAD

- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Verify assets are up to date
run: |
make clean
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/publish-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout repository
run: |
rm -rf .git
git init .
git remote add origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git"
git fetch --depth=1 origin "${{ github.sha }}"
git checkout --detach FETCH_HEAD

- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-publish-${{ hashFiles('**/Cargo.lock') }}

- name: Check formatting
run: cargo fmt --all -- --check

Expand Down
73 changes: 44 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout repository
run: |
rm -rf .git
git init .
git remote add origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git"
git fetch --depth=1 origin "${{ github.sha }}"
git checkout --detach FETCH_HEAD

- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Check formatting
run: cargo fmt --all -- --check

Expand All @@ -58,9 +55,14 @@ jobs:
needs: [test]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout repository
run: |
rm -rf .git
git init .
git remote add origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git"
git fetch --force --tags origin "+refs/heads/*:refs/remotes/origin/*"
git fetch --force origin "${{ github.sha }}"
git checkout --detach FETCH_HEAD

- name: Get version
id: version
Expand Down Expand Up @@ -89,19 +91,32 @@ jobs:
echo "EOF" >> $GITHUB_OUTPUT

- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: v${{ steps.version.outputs.version }}
body: |
## What's Changed

${{ steps.changelog.outputs.changelog }}

## Installation

```toml
[dependencies]
solverforge-ui = "${{ steps.version.outputs.version }}"
```
draft: false
prerelease: ${{ contains(steps.version.outputs.version, '-') }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
cat <<'EOF' > release-notes.md
## What's Changed

${{ steps.changelog.outputs.changelog }}

## Installation

```toml
[dependencies]
solverforge-ui = "${{ steps.version.outputs.version }}"
```
EOF

release_args=(
"v${{ steps.version.outputs.version }}"
--target "${{ github.sha }}"
--title "v${{ steps.version.outputs.version }}"
--notes-file release-notes.md
--verify-tag
)

if [[ "${{ steps.version.outputs.version }}" == *-* ]]; then
release_args+=(--prerelease)
fi

gh release create "${release_args[@]}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require the release tag to exist before publishing

gh release create will auto-create v${{ steps.version.outputs.version }} when that tag is missing. In this workflow the version value is entered manually on workflow_dispatch, so a typo or a forgotten git push --tags now publishes a brand-new tag at ${{ github.sha }} instead of failing fast. Adding --verify-tag (or checking the tag first) would prevent accidentally cutting a release from the wrong commit.

Useful? React with 👍 / 👎.