You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello guys, I'm using this repo and wanted to contribute with a workflow I made using github actions.
This workflow will autogenerate the last version and tag, the CHANGELOG.md file and updated them in the destination branch, and in the package.json file (the version) and generate a new release on github releases.
Here is the code, it was made for an UI release but I think it will work anyways in any repo. In any case we can arrange it for this repo if you want it (I would be glad to help with it).
name: Release new versionon:
pull_request: # in my repo, for each pull request closed on main. we can change it accordingly.branches: [main]types: [closed]paths-ignore:
- '*.md'jobs:
build:
name: Publish new releaseruns-on: ubuntu-lateststrategy:
matrix:
node-version: [16.x] # if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'staging' # For only merged pull requests from staging to trigger this jobsteps:
- uses: actions/checkout@v2with:
ref: ${{ github.head_ref }}token: ${{ secrets.GITHUB_TOKEN }} # Generate tag and the version of the current release
- name: Bump version and push tagid: tag_versionuses: mathieudutour/[email protected]with:
github_token: ${{ secrets.GITHUB_TOKEN }}release_branches: mainpre_release_branches: stagingappend_to_pre_release_tag: 'pre-'# set the version of the current release without the prefix
- name: Set versionrun: | VERSION=${{ steps.tag_version.outputs.new_tag }} echo "VERSION=${VERSION:1}" >> $GITHUB_ENV# Updated the package.json file with the new version
- name: 'Package.json Version update'uses: 'phips28/gh-action-bump-version@master'env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}with:
skip-tag: 'true'target-branch: ${{ github.event.pull_request.base.ref }}commit-message: 'CI: bumps version to {{version}} [skip ci]'default: '${{ env.VERSION }}'# update changelog file based on data from the previous step
- name: Update Changeloguses: stefanzweifel/changelog-updater-action@v1with:
# Pass the output from the tag_version step: new tag, release date, changelog generated and version to the Action.latest-version: ${{ steps.tag_version.outputs.new_tag }}release-notes: ${{ steps.tag_version.outputs.changelog }}release-date: ${{ steps.tag_version.outputs.release_date }}compare-url-target-revision: ${{ github.event.pull_request.head.ref }}# Commit the changelog file updated on PR base branch
- name: Commit updated CHANGELOG on PR base branchuses: stefanzweifel/git-auto-commit-action@v4with:
skip_fetch: falseskip_checkout: falsebranch: ${{ github.event.pull_request.base.ref }}commit_message: Update CHANGELOG for ${{ steps.tag_version.outputs.new_tag }}file_pattern: CHANGELOG.mdpush_options: '--force'# User configuration that will made the commit to the branch, maybe we need to configure it accordinglycommit_user_name: John Doe # defaults to "github-actions[bot]"commit_user_email: [email protected]# defaults to "github-actions[bot]@users.noreply.github.com"commit_author: John Doe <[email protected]> # defaults to author of the commit that triggered the run# Generate the release
- name: Create a GitHub releaseuses: ncipollo/release-action@v1with:
tag: ${{ steps.tag_version.outputs.new_tag }}name: Release ${{ steps.tag_version.outputs.new_tag }}body: ${{ steps.tag_version.outputs.changelog }}
I hope it helps! And also thanks for the hard work of this starter template. It rocks!!
Happy to be helping you guys.
Best regards!
The text was updated successfully, but these errors were encountered:
Hello guys, I'm using this repo and wanted to contribute with a workflow I made using github actions.
This workflow will autogenerate the last version and tag, the CHANGELOG.md file and updated them in the destination branch, and in the package.json file (the version) and generate a new release on github releases.
Here is the code, it was made for an UI release but I think it will work anyways in any repo. In any case we can arrange it for this repo if you want it (I would be glad to help with it).
I hope it helps! And also thanks for the hard work of this starter template. It rocks!!
Happy to be helping you guys.
Best regards!
The text was updated successfully, but these errors were encountered: