Improves release workflow

This commit is contained in:
Filipe PINTO 2023-06-02 11:32:34 +02:00 committed by lepapareil
parent 1e01257c6c
commit 0a409b51d1
No known key found for this signature in database
GPG Key ID: F4F06B068FB00692
2 changed files with 27 additions and 45 deletions

View File

@ -4,25 +4,14 @@ on:
workflow_dispatch:
inputs:
set-release-version:
description: 'Set release version (x.y.z)'
description: 'Desired delivery version (x.y.z)'
required: true
type: string
create-release-branch:
description: 'Create release branch'
required: true
type: boolean
default: true
deliver-github-release:
description: 'Deliver GitHub release'
required: true
type: boolean
default: true
concurrency: release
jobs:
set-context:
if: github.event.inputs.create-release-branch == 'true'
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ secrets.HURL_BOT_TOKEN }}
@ -37,7 +26,7 @@ jobs:
if [ $(echo "${{ github.ref_name }}" | grep -Ec "^master$|^release/") -eq 1 ] ; then
echo " - ✅ The branch triggering this workflow is ${{ github.ref_name }}."
else
echo " - ❌ The branch triggering this workflow is ${{ github.ref_name }} instead of master or release/[0-9].[0-9].[0-9] ."
echo " - ❌ The branch triggering this workflow is ${{ github.ref_name }} instead of master or release/[0-9].[0-9].[0-9]."
exit 1
fi
@ -55,17 +44,7 @@ jobs:
echo "release_branch=release/${{ github.event.inputs.set-release-version }}" | tee -a $GITHUB_OUTPUT
fi
- name: Control release version
run: |
if [ "${{ github.event.inputs.set-release-version }}" == "${{ steps.set-release-version.outputs.release_version }}" ] ; then
echo " - ✅ Desired release version ${{ github.event.inputs.set-release-version }} equals version ${{ steps.set-release-version.outputs.release_version }} getted from package/hurl/Cargo.toml on ${{ github.ref_name }}."
else
echo " - ❌ Desired release version ${{ github.event.inputs.set-release-version }} do not equals version ${{ steps.set-release-version.outputs.release_version }} getted from package/hurl/Cargo.toml on ${{ github.ref_name }}."
exit 1
fi
clean-release:
if: github.event.inputs.create-release-branch == 'true'
needs: set-context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
@ -178,18 +157,18 @@ jobs:
exit 1
fi
create-release-branch:
if: github.event.inputs.create-release-branch == 'true'
update-release-branch:
needs:
- clean-release
- set-context
- clean-release
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ secrets.HURL_BOT_TOKEN }}
name: create-release-branch
name: update-release-branch
runs-on: ubuntu-latest
steps:
- name: Checkout repository
if: github.ref_name == 'master'
uses: actions/checkout@v3
- name: Create release branch
@ -296,9 +275,8 @@ jobs:
needs:
- set-context
- clean-release
- create-release-branch
- update-release-branch
name: package-release
if: github.event.inputs.deliver-github-release == 'true'
uses: ./.github/workflows/package.yml
with:
branch: ${{ needs.set-context.outputs.release_branch }}
@ -311,10 +289,9 @@ jobs:
needs:
- set-context
- clean-release
- create-release-branch
- update-release-branch
- package-release
name: deliver-github-release
if: github.event.inputs.deliver-github-release == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout new release branch
@ -388,4 +365,3 @@ jobs:
echo " - ❌ A problem occurs when attempting to create new pull request."
exit 1
fi

View File

@ -11,7 +11,10 @@ We always have to start with current version x.y.0-snapshot (in all Cargo.toml).
## Release steps
- Run `release.yml` workflow on `master` branch, it will:
Used to publish a new release from master branch (normal process).
- Run `release.yml` workflow on `master` branch
- Fill `Desired delivery version` input with the `x.y.z` version you want to publish, it will:
- Clean pending release
- Create new `release/x.y.0` branch
- Checkout this new branch
@ -21,7 +24,8 @@ We always have to start with current version x.y.0-snapshot (in all Cargo.toml).
- Create the `x.y.0` tag
- Create draft GitHub release `x.y.0`
- Create PR from `release/x.y.0` to `master`
- Publish the draft release
- Publish the draft release
- Change the release status from draft to public on github
- Accept the PR from `release/x.y.0` to `master` with `/accept`
- Run `update-branch-version.yml` workflow on `master` branch, filling in the `desired SNAPSHOT version`, it will:
- Create `bot/update-branch-version-master` branch
@ -33,26 +37,28 @@ We always have to start with current version x.y.0-snapshot (in all Cargo.toml).
## Hotfix steps
- Create a new branch `hotfix/x.y.z` from desired tag `x.y.0`, for example `hotfix/1.8.1` from tag `1.8.0`
- Run `update-branch-version.yml` workflow on the new branch filling version field with `x.y.z`
- Run release.yml workflow on `hotfix/x.y.z` branch, it will:
Used when you want to deliver a fix from a published release (tag).
- Create a new branch `release/x.y.z` from desired tag `x.y.z` by increasing the patch version, for example `release/4.0.1` from tag `4.0.0`
- Run `release.yml` workflow on existing `release/x.y.z` branch
- Fill `Desired delivery version` input your `x.y.z` version, it will:
- Clean pending release
- Create new `release/x.y.z` branch
- Checkout this new branch
- Update all toml, crates, man and docs with `x.y.z`
- Generate CHANGELOG
- Commit all updates
- Create the `x.y.z` tag
- Create draft GitHub release `x.y.`
- Create draft GitHub release `x.y.z`
- Create PR from `release/x.y.z` to `master`
- Publish the draft release
- You have to manually `merge` as a revert rebase to reorder commits between this new release and master
- Publish the draft release
- Change the release status from draft to public on github
- Close the PR from `release/x.y.z` to `master` and manage it manually rebasing commits to reorder history and keep it linear
## Additional
- Push package to Chocolatey
- Push package to winget
- Push package to Docker
- Push package to Brew
- Push package to [Chocolatey](https://github.com/Orange-OpenSource/hurl/tree/master/contrib/windows/windows_package_managers/chocolatey)
- Push package to [Winget](https://github.com/Orange-OpenSource/hurl/tree/master/contrib/windows/windows_package_managers/winget)
- Push package to [Docker](contrib/docker)
- Push package to [Brew](https://github.com/Orange-OpenSource/hurl/tree/master/contrib/brew)
- Push source packages to crates.io