Release #60
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: | |
workflow_run: | |
workflows: | |
- Tests | |
types: [completed] | |
branches: | |
- main | |
- release/** | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
semantic-release: | |
name: π€ Semantic release | |
runs-on: ubuntu-latest | |
if: "github.event.workflow_run.conclusion == 'success'" | |
outputs: | |
release: ${{ steps.tag_release.outputs.release }} | |
version: ${{ steps.tag_release.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Install semantic-release | |
run: | | |
npm i npx | |
npm i semantic-release/changelog | |
- name: Tag release | |
id: tag_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npx semantic-release | tee semantic-release.log | |
if [[ `git tag --points-at HEAD` == "" ]]; then | |
echo "release=False" >> $GITHUB_OUTPUT | |
else | |
echo "release=True" >> $GITHUB_OUTPUT | |
awk '/Published release/ { printf("version=v%s\n",$8) }' semantic-release.log >> $GITHUB_OUTPUT | |
fi | |
package-release: | |
name: π¦ release archives | |
needs: [semantic-release] | |
if: ${{ needs.semantic-release.outputs.release == 'True' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.semantic-release.outputs.version }} | |
prerelease: false | |
generate_release_notes: true | |
npm-release: | |
name: π¦ npm release | |
runs-on: ubuntu-latest | |
needs: [semantic-release] | |
if: ${{ needs.semantic-release.outputs.release == 'True' }} | |
steps: | |
- name: βοΈ Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
registry-url: 'https://registry.npmjs.org' | |
- name: β¬ Download artifact | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: tests.yml | |
name: javascript-artifact | |
path: . | |
- name: π Set version | |
run: | | |
version=${{ needs.semantic-release.outputs.version }} | |
npm version --new-version ${version:1} --no-git-tag-version | |
- name: π¦ Publish | |
run: npm publish . --tag latest --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |