Release by @rbioteau #35
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
name: Release | |
run-name: Release ${{inputs.release}} by @${{github.actor}} | |
on: | |
workflow_dispatch: | |
inputs: | |
releases: | |
type: choice | |
description: Choose the release type to do (Following SemVer) | |
options: [ patch, minor, major ] | |
jobs: | |
release: | |
permissions: | |
contents: write | |
name: Release pipeline | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Update version | |
id: newversion | |
run: | | |
npm version ${{github.event.inputs.releases}} --git-tag-version false | |
VERSION=$(cat ./package.json | jq '.version' | tr -d '"') | |
sed -i "s/version:.*/version: $VERSION/" openapi/openapi.yaml | |
echo "release-tag=$VERSION" >> $GITHUB_OUTPUT | |
- name: Build | |
run: | | |
npm ci | |
npm run package | |
- name: Push tag and commit release | |
run: | | |
git config --global user.email "bonita-ci@bonitasoft.com" | |
git config --global user.name "Bonita CI" | |
git add package.json package-lock.json openapi/openapi.yaml | |
git commit -m "Release ${{ steps.newversion.outputs.release-tag }}" | |
git tag ${{ steps.newversion.outputs.release-tag }} | |
git push origin ${{github.ref}} ${{ steps.newversion.outputs.release-tag }} | |
- name: Prepare artifacts to release | |
run: | | |
mv dist/openapi.yaml dist/bonita-openapi-${{ steps.newversion.outputs.release-tag }}.yaml | |
mv dist/postman.json dist/bonita-postman-collection-${{ steps.newversion.outputs.release-tag }}.json | |
- name: Create Release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.newversion.outputs.release-tag }} | |
name: Release ${{ steps.newversion.outputs.release-tag }} | |
artifacts: dist/* | |
- name: Open Bonita Java Client PR | |
id: open_client_pr | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.BONITA_CI_PAT }} | |
repository: bonitasoft/bonita-java-client | |
event-type: new-bonita-openapi-spec-release | |
client-payload: '{"spec_version": "${{steps.newversion.outputs.release-tag}}"}' |