Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 29 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 0 additions & 1 deletion CHANGELOG.md

This file was deleted.