-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now, on each push on master, a new stable release is made following semver using commit logs with Knope
- Loading branch information
1 parent
3395096
commit 0aa76e1
Showing
20 changed files
with
439 additions
and
228 deletions.
There are no files selected for viewing
Empty file.
File renamed without changes.
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 @@ | ||
extends: ['@commitlint/config-conventional'] |
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Open Release PR | ||
|
||
on: | ||
push: | ||
branches: [main, staging, release] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
CLICOLOR: 1 | ||
RUST_VERSION: 1.78.0 | ||
|
||
jobs: | ||
setup: | ||
if: "!startsWith(github.event.head_commit.message, 'ci(bump)')" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
branch: ${{ steps.set-vars.outputs.branch }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check for pre-release configuration | ||
id: set-vars | ||
run: | | ||
echo "branch=changeset/release-main" >> $GITHUB_OUTPUT | ||
prepare-release: | ||
if: "!startsWith(github.event.head_commit.message, 'ci(bump)')" | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.REPO_TOKEN }} | ||
|
||
- name: Configure Git | ||
run: | | ||
git config --global user.name GitHub Actions | ||
git config user.email github-actions@github.com | ||
- name: Cache Rust dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- run: rustup toolchain install nightly -c rustfmt | ||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-sort@1.0.9, cargo-edit@0.12.3 | ||
|
||
- uses: knope-dev/action@v2.1.0 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Run knope prepare release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} | ||
RELEASE_BRANCH: ${{ needs.setup.outputs.branch }} | ||
run: knope prepare-release --verbose |
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 |
---|---|---|
@@ -1,121 +1,72 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: [main, staging, release] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
pull_request: | ||
types: [closed] | ||
branches: [main] | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
prerelease: ${{ steps.set-prerelease.outputs.prerelease }} | ||
build-artifacts: | ||
env: | ||
archive_name: artifact | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
pkg: [fuel-nats-stream] | ||
os: [ubuntu-latest] | ||
target: [x86_64-unknown-linux-gnu] | ||
|
||
- name: Setup git user (for changelog step) | ||
run: | | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
- name: Check for pre-release configuration | ||
id: set-prerelease | ||
run: | | ||
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then | ||
echo "prerelease=nightly" >> $GITHUB_OUTPUT | ||
elif [[ "${GITHUB_REF}" == "refs/heads/staging" ]]; then | ||
echo "prerelease=rc" >> $GITHUB_OUTPUT | ||
else | ||
echo "prerelease=false" >> $GITHUB_OUTPUT | ||
changelog: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
outputs: | ||
version: ${{ steps.save-outputs.outputs.version }} | ||
changelog: ${{ steps.save-outputs.outputs.changelog }} | ||
commit_message: ${{ steps.save-outputs.outputs.commit_message }} | ||
branch: ${{ steps.save-outputs.outputs.branch }} | ||
runs-on: ${{ matrix.os }} | ||
name: ${{ matrix.pkg }} ${{ matrix.target }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- id: cz | ||
name: Create bump and changelog | ||
uses: commitizen-tools/commitizen-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
changelog_increment_filename: body.md | ||
prerelease: ${{ needs.setup.outputs.prerelease }} | ||
- uses: actions/checkout@v4 | ||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Save outputs | ||
id: save-outputs | ||
run: | | ||
version=${{ steps.cz.outputs.version }} | ||
changelog=$(cat body.md) | ||
commit_message="ci(bump): release ${version}" | ||
branch="release-${{ steps.cz.outputs.version }}" | ||
- name: Install host target | ||
run: rustup target add ${{ matrix.target }} | ||
|
||
echo "version=${version}" >> $GITHUB_OUTPUT | ||
echo "changelog=${changelog}" >> $GITHUB_OUTPUT | ||
echo "commit_message=${commit_message}" >> $GITHUB_OUTPUT | ||
echo "branch=${branch}" >> $GITHUB_OUTPUT | ||
- name: Build | ||
run: make build TARGET=${{ matrix.target }} PACKAGE=${{ matrix.pkg }} | ||
|
||
create_pr: | ||
runs-on: ubuntu-latest | ||
needs: changelog | ||
- name: Set Archive Name | ||
id: archive | ||
run: echo "archive_name=${{ matrix.pkg }}-${{ matrix.target }}" >> $GITHUB_ENV | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Create Tar Archive | ||
run: | | ||
mkdir ${{ env.archive_name }} | ||
cp target/${{ matrix.target }}/release/${{ matrix.pkg }} ${{ env.archive_name }} | ||
tar -czf ${{ env.archive_name }}.tgz ${{ env.archive_name }} | ||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v3 | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4.3.3 | ||
with: | ||
commit-message: ${{ needs.changelog.outputs.commit_message }} | ||
title: Release ${{ needs.changelog.outputs.version }} | ||
body: | | ||
${{ needs.changelog.outputs.changelog }} | ||
branch: ${{ needs.changelog.outputs.branch }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Check outputs | ||
if: ${{ steps.cpr.outputs.pull-request-number }} | ||
run: | | ||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | ||
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" | ||
name: ${{ matrix.pkg }}-${{ matrix.target }} | ||
path: ${{ env.archive_name }}.tgz | ||
if-no-files-found: error | ||
|
||
release: | ||
needs: [build-artifacts] | ||
runs-on: ubuntu-latest | ||
needs: changelog | ||
if: github.ref == 'refs/heads/release' | ||
|
||
permissions: | ||
contents: read | ||
actions: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
- uses: actions/checkout@v4.1.6 | ||
- uses: actions/download-artifact@v4.1.7 | ||
with: | ||
body_path: body.md | ||
tag_name: ${{ needs.changelog.outputs.version }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
path: artifacts | ||
merge-multiple: true | ||
|
||
notify: | ||
runs-on: ubuntu-latest | ||
if: failure() | ||
- name: List artifacts | ||
run: ls -R artifacts | ||
|
||
steps: | ||
- name: Error Notification | ||
run: |- | ||
echo "An error occurred during the release process" | ||
# Optionally, send a notification to Slack or email | ||
- uses: knope-dev/action@v2.1.0 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- run: knope release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.REPO_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 |
---|---|---|
|
@@ -13,3 +13,4 @@ lcov.info | |
node_modules/ | ||
pnpm-lock.yaml | ||
./package.json | ||
tmp |
Oops, something went wrong.