Configuration restructuration and NPM publication #4
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: Release | |
on: | |
pull_request: | |
branches: | |
- main | |
types: [ closed ] | |
jobs: | |
changelog: | |
uses: "OpenTermsArchive/federation-api/.github/workflows/changelog.yml@main" | |
test: | |
uses: "OpenTermsArchive/federation-api/.github/workflows/test.yml@main" | |
release: | |
if: github.event.pull_request.merged == true | |
needs: [ changelog, test ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} | |
- name: Configure Git author | |
run: | | |
git config --global user.name "Open Terms Archive Release Bot" | |
git config --global user.email "release-bot@opentermsarchive.org" | |
- name: Bump package version | |
run: | | |
echo "Release type obtained from the previous job: '${{ needs.changelog.outputs.release_type }}'" | |
echo "NEW_VERSION=$(npm --no-git-tag-version version ${{ needs.changelog.outputs.release_type }})" >> $GITHUB_ENV | |
- name: Update changelog unreleased section with new version | |
uses: superfaceai/release-changelog-action@v2 | |
with: | |
version: ${{ env.NEW_VERSION }} | |
operation: release | |
format: markdownlint | |
- name: Commit CHANGELOG.md and package.json changes and create tag | |
run: | | |
git add "package.json" | |
git add "package-lock.json" | |
git add "CHANGELOG.md" | |
git commit -m "Release ${{ env.NEW_VERSION }}" | |
git tag ${{ env.NEW_VERSION }} | |
- name: Run status checks for release commit on temporary branch # Use temporary branch to enable pushing commits to this branch protected by required status checks | |
uses: CasperWA/push-protected@v2 | |
with: | |
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} | |
branch: main | |
unprotect_reviews: true | |
- name: Push changes to repository | |
run: git push origin && git push --tags | |
- name: Read version changelog | |
uses: superfaceai/release-changelog-action@v2 | |
id: get-changelog | |
with: | |
version: ${{ env.NEW_VERSION }} | |
operation: read | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.NEW_VERSION }} | |
body: ${{ steps.get-changelog.outputs.changelog }} | |
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} | |
- name: Publish to NPM public repository | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPMJS_ACCESS_TOKEN }} |