From 375fd9088f0d6b5517da0e2baf30a68128ba8220 Mon Sep 17 00:00:00 2001 From: Randyblo7 <86910661+Randyblo7@users.noreply.github.com> Date: Fri, 12 Jan 2024 13:29:02 -0800 Subject: [PATCH] Create npm-publish.yml new --- .github/workflows/npm-publish.yml | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/npm-publish.yml diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 00000000..42a012ac --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,51 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - name: Download a Build Artifact + uses: actions/download-artifact@v4.1.1 + with: + # Name of the artifact to download. If unspecified, all artifacts for the run are downloaded. + name: # optional + # Destination path. Supports basic tilde expansion. Defaults to $GITHUB_WORKSPACE + path: # optional + # A glob pattern matching the artifacts that should be downloaded. Ignored if name is specified. + pattern: # optional + # When multiple artifacts are matched, this changes the behavior of the destination directories. If true, the downloaded artifacts will be in the same directory specified by path. If false, the downloaded artifacts will be extracted into individual named directories within the specified path. + merge-multiple: # optional, default is false + # The GitHub token used to authenticate with the GitHub API. This is required when downloading artifacts from a different repository or from a different workflow run. If this is not specified, the action will attempt to download artifacts from the current repository and the current workflow run. + github-token: # optional + # The repository owner and the repository name joined together by "/". If github-token is specified, this is the repository that artifacts will be downloaded from. + repository: # optional, default is ${{ github.repository }} + # The id of the workflow run where the desired download artifact was uploaded from. If github-token is specified, this is the run that artifacts will be downloaded from. + run-id: # optional, default is ${{ github.run_id }} + + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}}