Skip to content

Update contribution template #55

Update contribution template

Update contribution template #55

Workflow file for this run

name: Release
on:
pull_request_target:
branches: [ main, test-main ]
types: [ closed ]
jobs:
changelog:
uses: ./.github/workflows/changelog.yml
test:
uses: ./.github/workflows/test.yml
release:
if: github.event.pull_request.merged == true
needs: [ changelog, test ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update changelog
id: update-changelog
uses: OpenTermsArchive/changelog-action/release@v0.4.0
- name: Update package version
run: npm --no-git-tag-version --allow-same-version version ${{ steps.update-changelog.outputs.version }}
- name: Update repository
run: |
git config user.name "Open Terms Archive Release Bot"
git config user.email "release-bot@opentermsarchive.org"
git commit --message="Update changelog" CHANGELOG.md package.json package-lock.json
- 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.16.0 # 2.16 minimum is required to benefit from updated defaults
with:
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
branch: ${{ github.base_ref }}
interval: 10 # seconds between checks
pre_sleep: 15
fail_fast: true
- name: Publish Git tag
if: needs.changelog.outputs.release-type != 'no-release'
run: |
git tag v${{ steps.update-changelog.outputs.version }}
git push --tags
- name: Publish to NPM public repository
if: needs.changelog.outputs.release-type != 'no-release'
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPMJS_ACCESS_TOKEN }}
dry-run: ${{ github.base_ref != 'main' }}
- name: Publish GitHub release
if: needs.changelog.outputs.release-type != 'no-release'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.update-changelog.outputs.version }}
body: ${{ steps.update-changelog.outputs.content }}
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}