v0.26.1 #100
Workflow file for this run
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: NPM Publish | |
on: | |
release: | |
types: [published] | |
secrets: | |
NPM_TOKEN: | |
required: true | |
jobs: | |
publish: | |
if: github.repository_owner == 'viamrobotics' | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/viamrobotics/canon:amd64 | |
steps: | |
- name: Check if organization member | |
id: is_organization_member | |
if: github.event_name == 'workflow_dispatch' | |
uses: jamessingleton/is-organization-member@1.0.1 | |
with: | |
organization: viamrobotics | |
username: ${{ github.actor }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cancelling - not an organization member | |
uses: andymckay/cancel-action@0.2 | |
if: | | |
github.event_name == 'workflow_dispatch' && steps.is_organization_member.outputs.result == 'false' | |
- name: Download Release | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
file: "viamrobotics\\-sdk\\-.*\\.tgz" | |
regex: true | |
target: './' | |
version: tags/${{ github.event.release.tag_name }} | |
- name: Check Files | |
id: release_file | |
run: echo "path=$(ls -1 | head -1)" >> $GITHUB_OUTPUT | |
- name: Which Tag | |
id: which_tag | |
shell: bash | |
run: | | |
if ${{ contains(github.event.release.tag_name, 'rc') }} ; then | |
echo "tag=rc" >> $GITHUB_OUTPUT | |
else | |
echo "tag=latest" >> $GITHUB_OUTPUT | |
fi | |
- name: Publish | |
id: publish | |
uses: JS-DevTools/npm-publish@v2 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
tag: ${{ steps.which_tag.outputs.tag }} | |
package: ${{ steps.release_file.outputs.path }} | |
- name: Notify Slack | |
uses: slackapi/slack-github-action@v1.24.0 | |
if: ${{ steps.publish.outputs.tag == 'latest' }} | |
with: | |
payload: | | |
{ | |
"text": "${{ github.event.release.tag_name }} was released.\n${{ github.event.release.html_url }}" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |