From 65da5357455b11cd395757182f07b0ee22025e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Sun, 25 Aug 2024 11:02:29 +0300 Subject: [PATCH] chore(ci): update release strategy (#1337) closes #1232 Now we can trigger point releases by pushing a tag (follow the instructions in `RELEASE.md`). This will create a release with generated changelog. There is still a lack of automation (e.g. updating `CHANGELOG.md`), but this PR is a good start towards improving that. --- .../workflows/{cd.yml => release-alpha.yml} | 30 +++---------- .github/workflows/release-stable.yml | 45 +++++++++++++++++++ RELEASE.md | 9 +++- 3 files changed, 59 insertions(+), 25 deletions(-) rename .github/workflows/{cd.yml => release-alpha.yml} (57%) create mode 100644 .github/workflows/release-stable.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/release-alpha.yml similarity index 57% rename from .github/workflows/cd.yml rename to .github/workflows/release-alpha.yml index cec034e5..616a917a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/release-alpha.yml @@ -1,4 +1,4 @@ -name: Continuous Deployment +name: Release alpha version on: workflow_dispatch: @@ -6,9 +6,6 @@ on: # At 00:00 on Saturday # https://crontab.guru/#0_0_*_*_6 - cron: "0 0 * * 6" - push: - tags: - - "v*.*.*" defaults: run: @@ -20,7 +17,6 @@ jobs: runs-on: ubuntu-latest permissions: contents: write - if: ${{ !startsWith(github.event.ref, 'refs/tags/v') }} steps: - name: Checkout the repository uses: actions/checkout@v4 @@ -30,11 +26,11 @@ jobs: - name: Calculate the next release run: .github/workflows/calculate-alpha-release.bash - - name: Publish on crates.io - uses: actions-rs/cargo@v1 - with: - command: publish - args: --allow-dirty --token ${{ secrets.CARGO_TOKEN }} + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + + - name: Publish + run: cargo publish --allow-dirty --token ${{ secrets.CARGO_TOKEN }} - name: Generate a changelog uses: orhun/git-cliff-action@v3 @@ -50,17 +46,3 @@ jobs: tag: ${{ env.NEXT_TAG }} prerelease: true bodyFile: BODY.md - - publish-stable: - name: Create a stable release - runs-on: ubuntu-latest - if: ${{ startsWith(github.event.ref, 'refs/tags/v') }} - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - - - name: Publish on crates.io - uses: actions-rs/cargo@v1 - with: - command: publish - args: --token ${{ secrets.CARGO_TOKEN }} diff --git a/.github/workflows/release-stable.yml b/.github/workflows/release-stable.yml new file mode 100644 index 00000000..17694fdd --- /dev/null +++ b/.github/workflows/release-stable.yml @@ -0,0 +1,45 @@ +name: Release stable version + +on: + push: + tags: + - "v*.*.*" + +jobs: + publish-stable: + name: Create an stable release + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Generate a changelog + uses: orhun/git-cliff-action@v3 + with: + config: cliff.toml + args: --latest --strip header + env: + OUTPUT: BODY.md + + - name: Publish on GitHub + uses: ncipollo/release-action@v1 + with: + prerelease: false + bodyFile: BODY.md + + publish-crate: + name: Publish crate + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + + - name: Publish + run: cargo publish --token ${{ secrets.CARGO_TOKEN }} diff --git a/RELEASE.md b/RELEASE.md index fd2069a4..1bf50bde 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,12 @@ # Creating a Release +Our release strategy is: + +> Release major versions with detailed summaries when necessary, while releasing minor versions +> weekly or as needed without extensive announcements. +> +> Versioning scheme being `0.x.y`, where `x` is the major version and `y` is the minor version. + [crates.io](https://crates.io/crates/ratatui) releases are automated via [GitHub actions](.github/workflows/cd.yml) and triggered by pushing a tag. @@ -21,7 +28,7 @@ actions](.github/workflows/cd.yml) and triggered by pushing a tag. can be used for generating the entries. 1. Ensure that any breaking changes are documented in [BREAKING-CHANGES.md](./BREAKING-CHANGES.md) 1. Commit and push the changes. -1. Create a new tag: `git tag -a v[X.Y.Z]` +1. Create a new tag: `git tag -a v[0.x.y]` 1. Push the tag: `git push --tags` 1. Wait for [Continuous Deployment](https://github.com/ratatui/ratatui/actions) workflow to finish.