diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d3c856..1689cd4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,8 @@ jobs: # Checkout project repository - name: Checkout uses: actions/checkout@v2.3.4 + with: + ref: enable-auto-commit # Setup Node.js environment - name: Setup Node.js @@ -45,38 +47,42 @@ jobs: # Bump package version # Use tag latest - name: Bump release version - if: startsWith(github.event.inputs.release-type, 'pre') != true run: | echo "NEW_VERSION=$(npm --no-git-tag-version version $RELEASE_TYPE)" >> $GITHUB_ENV echo "RELEASE_TAG=latest" >> $GITHUB_ENV env: RELEASE_TYPE: ${{ github.event.inputs.release-type }} - # Update changelog unreleased section with new version - # - name: Update changelog - # uses: superfaceai/release-changelog-action@v1 - # with: - # path-to-changelog: CHANGELOG.md - # version: ${{ env.NEW_VERSION }} - # operation: release + # Create PR for version bump + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v4 + with: + title: "Release ${{ env.NEW_VERSION }}" + commit-message: "Release ${{ env.NEW_VERSION }}" + branch: "release_${{ env.NEW_VERSION }}" + delete-branch: true + token: ${{ secrets.PAT }} + + # Enable automerge for PR + - name: Enable automerge + if: steps.cpr.outputs.pull-request-operation == 'created' + uses: peter-evans/enable-pull-request-automerge@v2 + with: + token: ${{ secrets.PAT }} + pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} + merge-method: squash - # Commit changes - # - name: Commit CHANGELOG.md and package.json changes and create tag - # run: | - # git add "package.json" - # git add "CHANGELOG.md" - # git commit -m "chore: release ${{ env.NEW_VERSION }}" - # git tag ${{ env.NEW_VERSION }} + # Automatically approve PR + - name: Auto approve + if: steps.cpr.outputs.pull-request-operation == 'created' + uses: juliangruber/approve-pull-request-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + number: ${{ steps.cpr.outputs.pull-request-number }} # Publish version to public repository - name: Publish run: yarn publish --verbose --access public --tag ${{ env.RELEASE_TAG }} env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - # Push repository changes - - name: Push changes to repository - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git push origin && git push --tags \ No newline at end of file + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 19ad7ff..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1 +0,0 @@ -This package is currently in alpha for public testing \ No newline at end of file