Skip to content

fix: leftover migration (#143) #71

fix: leftover migration (#143)

fix: leftover migration (#143) #71

name: Create Release
on:
workflow_dispatch:
push:
branches:
- main
- tmp_hotfix_branch
env:
IS_HOTFIX: ${{ github.ref == 'refs/heads/tmp_hotfix_branch' }}
IS_PRERELEASE: ${{ github.event_name == 'push' && github.ref != 'refs/heads/tmp_hotfix_branch' }}
IS_MANUAL: ${{ contains(github.event.head_commit.message, 'chore(release)') }}
NX_BRANCH: ${{ github.event.number || github.ref_name }}
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}
jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Fetch from origin repo
uses: actions/checkout@v3
with:
ref: ${{ fromJSON('["tmp_hotfix_branch", "main"]')[env.IS_HOTFIX] }}
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Set up git user
run: |
git config --global user.email "${{ secrets.GH_MAIL }}"
git config --global user.name "${{ secrets.GH_USERNAME }}"
- name: Setup Node.js and Cache
uses: ./.github/actions/nodejs
- name: Get next version
id: bumpVersion
uses: ./.github/actions/bump-version
with:
isManual: ${{ env.IS_MANUAL }}
isPrerelease: ${{ env.IS_PRERELEASE }}
isHotfix: ${{ env.IS_HOTFIX }}
- name: Update using lerna # Skipping push, in case something goes wrong later during build/prepare
if: env.IS_MANUAL == 'false'
run: |
npx lerna version ${{ steps.bumpVersion.outputs.newVersion }} --yes --force-publish --message="chore(release): publish %v [ci skip]" --no-push
- name: Prepare
run: npx nx run-many --target=prepare --all
- name: Publish on npm ui5-angular
uses: JS-DevTools/npm-publish@v1
with:
package: dist/libs/ui5-angular/package.json
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ steps.bumpVersion.outputs.releaseTag }}
access: public
- name: Publish on npm ui5-angular-theming
uses: JS-DevTools/npm-publish@v1
with:
package: dist/libs/ui5-angular-theming/package.json
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ steps.bumpVersion.outputs.releaseTag }}
access: public
- name: Push changes
if: env.IS_MANUAL == 'false'
run: git push --follow-tags # This Will NOT trigger this workflow again, so it is okay
- name: Generate Release Body # This will delete locally some tags to properly generate the release notes, so it should go after the push to upstream
id: generate_body
uses: ./.github/actions/generate-conventional-release-notes
- name: Create Release
uses: ncipollo/[email protected]
with:
prerelease: ${{ steps.bumpVersion.outputs.isPrerelease }}
tag: v${{ steps.bumpVersion.outputs.newVersion }}
body: ${{ steps.generate_body.outputs.generatedReleaseNotes }}
- name: Update version on main
if: env.IS_HOTFIX == 'true' && steps.bumpVersion.outputs.releaseTag == 'latest'
run: |
git checkout -f main
npx lerna version ${{ steps.bumpVersion.outputs.newVersion }} --yes --force-publish --no-push --no-changelog --no-git-tag-version --no-changelog
git add .
git commit -m "chore(release): sync version after hotfix v${{ steps.bumpVersion.outputs.newVersion }}"
git push origin main
- name: Delete Temporary hotfix branch
if: env.IS_HOTFIX == 'true'
run: git push origin --delete tmp_hotfix_branch