Merge pull request #701 from nevermined-io/feat/rename #242
Workflow file for this run
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: GitHub Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
release: | |
name: 'Tagged Release' | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
# Build process | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Set version to env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Build package | |
run: | | |
yarn | |
npm pack | |
- name: Update CHANGELOG.md | |
id: changelog | |
run: | | |
yarn add --dev auto-changelog | |
npx auto-changelog | |
- name: Detect branch to commit changelog | |
id: branch-changelog | |
run: | | |
tagged_branches=$(git --no-pager branch -a --contains tags/${{ env.RELEASE_VERSION }} --no-column) | |
echo "$tagged_branches" | |
if echo "$tagged_branches" | grep -E '^[[:space:]]*main$' > /dev/null; then | |
commit_branch=main | |
elif echo "$tagged_branches" | grep -E '^[[:space:]]*main$' > /dev/null; then | |
commit_branch=main | |
elif echo "$tagged_branches" | grep -E '^[[:space:]]*develop$' > /dev/null; then | |
commit_branch=develop | |
else | |
commit_branch=$(echo "$tagged_branches" | tail -n1) | |
commit_branch=${commit_branch//[[:blank:]]/} | |
fi | |
commit_branch="${commit_branch//remotes\/origin\//}" | |
echo "COMMIT_BRANCH=${commit_branch}" >> $GITHUB_ENV | |
- name: Commit CHANGELOG.md | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Automated CHANGELOG.md update | |
commit_options: '--no-verify --signoff' | |
file_pattern: CHANGELOG.md | |
branch: ${{ env.COMMIT_BRANCH }} | |
- name: Publish Github relase | |
uses: 'marvinpinto/action-automatic-releases@latest' | |
with: | |
repo_token: '${{ secrets.GITHUB_TOKEN }}' | |
prerelease: false | |
files: | | |
CHANGELOG.md | |
nevermined-io-nevermined-sdk-js-${{ env.RELEASE_VERSION }}.tgz |