-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: another attempt ro fix CI for changelog
- Loading branch information
Showing
3 changed files
with
67 additions
and
43 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,65 @@ | ||
name: Changelog | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUST_BACKTRACE: 1 | ||
RUSTFLAGS: "-D warnings" | ||
RUSTDOCFLAGS: '--deny warnings' | ||
|
||
permissions: | ||
id-token: write | ||
packages: write | ||
contents: write | ||
pull-requests: write | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
changelog: | ||
name: Create changelog | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
- id: release | ||
run: echo "version=$(cargo pkgid --manifest-path crates/bin/Cargo.toml | cut -d '@' -f2)" >> "$GITHUB_OUTPUT" | ||
- name: Install git-cliff | ||
run: cargo install git-cliff | ||
- name: Generate a changelog | ||
run: | | ||
if [ -f CHANGELOG.md ]; then | ||
git-cliff --config github --prepend CHANGELOG.md --latest | ||
else | ||
git-cliff --config github --output CHANGELOG.md | ||
fi | ||
env: | ||
OUTPUT: CHANGELOG.md | ||
GITHUB_REPO: ${{ github.repository }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Commit changelog | ||
run: | | ||
git checkout -b "changelog/v${{ steps.release.outputs.version }}" | ||
git config user.name 'github-actions[bot]' | ||
git config user.email 'github-actions[bot]@users.noreply.github.com' | ||
set +e | ||
git add CHANGELOG.md | ||
git commit -m "chore: Update changelog" | ||
git push origin "changelog/v${{ steps.release.outputs.version }}" --force | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: "changelog/v${{ steps.release.outputs.version }}" | ||
- name: Create pull request for changelog | ||
run: | | ||
alreadyExists=$(gh pr list --json headRefName | jq '.[] | select(.headRefName == "changelog/v${{ steps.release.outputs.version }}") | any') | ||
if [[ "$alreadyExists" == "" ]]; then | ||
branch=$(git branch --show-current) | ||
gh pr create --head "$branch" --title "Changelog for ${{ steps.release.outputs.version }}" --body "This PR updates the changelog for version ${{ steps.release.outputs.version }}." | ||
fi | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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 |
---|---|---|
|
@@ -8,7 +8,6 @@ lol/rust/Cargo.lock | |
semver-checks/ | ||
demo.sh | ||
ee.json | ||
.github/ | ||
|
||
crates/**/*.cdx.xml | ||
crates/**/*.cdx.json | ||
|