Publish #123
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: Publish | |
on: | |
create: | |
tags: | |
- '*' | |
jobs: | |
generate_proto: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- run: npm install | |
- run: npm run generate_pb | |
- name: Cache proto | |
uses: actions/upload-artifact@v2 | |
with: | |
name: proto | |
path: ./src/config/generated.* | |
build: | |
runs-on: ubuntu-20.04 | |
needs: generate_proto | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@hypertrace' | |
- name: Check tag format | |
run: | | |
if [[ "$GITHUB_REF" =~ ^refs/tags/v?([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then | |
echo "Tag is valid" | |
else | |
echo "Tag $GITHUB_REF does not look like expected version string" | |
exit 0 | |
fi | |
- run: npm install | |
- run: npm install -g [email protected] | |
- uses: actions/download-artifact@v2 | |
with: | |
name: proto | |
path: ./src/config/ | |
- run: npm run build | |
- name: Publish to npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLIC_PUBLISH_TOKEN }} |