Revert "Release new version (#225)" (#232) #173
This file contains hidden or 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: Create new release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| changesets: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Get tags | |
| run: git fetch --tags origin | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v3 | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Create Release Pull Request | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| title: 'New Release' | |
| commit: 'Release new version' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.SDK_PUBLISH_TOKEN }} | |
| - name: Create new release | |
| if: steps.changesets.outputs.hasChangesets == 'false' | |
| run: | | |
| npx changeset tag && git push origin --tags | |
| COMMIT_TAG=$(git tag --points-at HEAD) | |
| if [ -n "$COMMIT_TAG" ]; then | |
| echo "A tag is attached to HEAD. Creating a new release..." | |
| echo "${{ secrets.SDK_PUBLISH_TOKEN }}" | gh auth login --with-token | |
| CHANGELOG=$(awk ' | |
| BEGIN { recording=0; } | |
| /^## / { | |
| if(recording) { exit; } | |
| recording=1; | |
| next; | |
| } | |
| recording { | |
| print; | |
| } | |
| ' CHANGELOG.md) | |
| gh release create $COMMIT_TAG -t "$COMMIT_TAG" -n "$CHANGELOG" | |
| echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
| npm publish | |
| else | |
| echo "No tag attached to HEAD. No new release needed." | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.PUBLIC_REPO_NPM_PUBLISH }} | |