Merge pull request #30 from sammygriffiths/release/v0.8.2 #5
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: build | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'latest' | |
- run: npm ci | |
- run: npm test | |
get_tag: | |
name: Get Tag | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.get_tag.outputs.tag }} | |
tag_exists: ${{ steps.check_tag.outputs.exists }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get tag | |
id: get_tag | |
run: | | |
echo "##[set-output name=tag;]$(git log -1 --pretty=%B | tr '\n' ' ' | sed -E 's/.*(v[0-9]+\.[0-9]+\.[0-9]+).*/\1/')" | |
- name: Check if tag exists | |
uses: mukunku/tag-exists-action@v1.6.0 | |
id: check_tag | |
with: | |
tag: ${{ steps.get_tag.outputs.tag }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
tag: | |
name: Apply Tag | |
if: ${{ needs.get_tag.outputs.tag_exists == 'false' }} | |
runs-on: ubuntu-latest | |
needs: [get_tag, test] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Release | |
uses: elgohr/Github-Release-Action@v5 | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag: ${{ needs.get_tag.outputs.tag }} | |
title: ${{ needs.get_tag.outputs.tag }} | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: tag | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'latest' | |
registry-url: https://registry.npmjs.org/ | |
- name: Install NPM Packages | |
run: npm ci | |
- name: Deploy Release | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.npm_token}} |