Add GitLab functionalities #130
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_target: | |
branches: | |
- main | |
types: [ closed ] | |
jobs: | |
changelog: | |
uses: "./.github/workflows/changelog.yml" | |
test: | |
uses: "OpenTermsArchive/engine/.github/workflows/test.yml@main" | |
release: | |
needs: [ changelog, test ] | |
if: github.event.pull_request.merged == true && needs.changelog.outputs.release-type != 'no-release' | |
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 "[email protected]" | |
- name: Update changelog for release | |
id: release-changelog | |
uses: OpenTermsArchive/changelog-action/[email protected] | |
- name: Bump package version | |
run: npm --no-git-tag-version version ${{ steps.release-changelog.outputs.version }} | |
- 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 v${{ steps.release-changelog.outputs.version }}" | |
git tag v${{ steps.release-changelog.outputs.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: Create GitHub release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ steps.release-changelog.outputs.version }} | |
body: ${{ steps.release-changelog.outputs.content }} | |
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} | |
- name: Publish to NPM public repository | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPMJS_ACCESS_TOKEN }} | |
- name: Trigger documentation deploy | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.TRIGGER_DOCS_DEPLOY_TOKEN }} | |
event-type: engine-release | |
repository: OpenTermsArchive/docs | |
client-payload: '{"version": "v${{ steps.release-changelog.outputs.version }}"}' | |
clean_changelog: | |
if: github.event.pull_request.merged == true && needs.changelog.outputs.release-type == 'no-release' | |
needs: [ changelog ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
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 "[email protected]" | |
- name: Update changelog for release | |
uses: OpenTermsArchive/changelog-action/[email protected] | |
- name: Save changelog | |
run: | | |
git commit -m "Clean changelog" CHANGELOG.md | |
git push origin |