diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 00000000..7046c17a --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,112 @@ +# 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://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages + +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} + + publish-gpr: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + registry-url: https://npm.pkg.github.com/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Setup Node.js environment + uses: actions/setup-node@v2.1.5 + with: + # Set always-auth in npmrc + always-auth: # optional, default is false + # Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0 + node-version: # optional + # Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default. + architecture: # optional + # Set this option if you want the action to check for the latest available version that satisfies the version spec + check-latest: # optional + # Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN + registry-url: # optional + # Optional scope for authenticating against scoped registries + scope: # optional + # Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. + token: # optional, default is ${{ github.token }} + # Deprecated. Use node-version instead. Will not be supported after October 1, 2019 + version: # optional + - name: Cache + uses: actions/cache@v2.1.6 + with: + # A list of files, directories, and wildcard patterns to cache and restore + path: + # An explicit key for restoring and saving the cache + key: + # An ordered list of keys to use for restoring the cache if no cache hit occurred for key + restore-keys: # optional + # The chunk size used to split up large files during upload, in bytes + upload-chunk-size: # optional + - name: Setup Go environment + uses: actions/setup-go@v2.1.3 + with: + # The Go version to download (if necessary) and use. Supports semver spec and ranges. + go-version: # optional + # Whether to download only stable versions + stable: # optional, default is true + # Used to pull node distributions from go-versions. Since there's a default, this is typically not supplied by the user. + token: # optional, default is ${{ github.token }} + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v1.8.0 + with: + # Optional SDK version to use. If not provided, will install global.json version when available. Examples: 2.2.104, 3.1, 3.1.x + dotnet-version: # optional + # Optional package source for which to set up authentication. Will consult any existing NuGet.config in the root of the repo and provide a temporary NuGet.config using the NUGET_AUTH_TOKEN environment variable as a ClearTextPassword + source-url: # optional + # Optional OWNER for using packages from GitHub Package Registry organizations/users other than the current repository's owner. Only used if a GPR URL is also provided in source-url + owner: # optional + # Optional NuGet.config location, if your NuGet.config isn't located in the root of the repo. + config-file: # optional + # Whether prerelease versions should be matched with non-exact versions (for example 5.0.0-preview.6 being matched by 5, 5.0, 5.x or 5.0.x). Defaults to false if not provided. + include-prerelease: # optional + - name: First interaction + uses: actions/first-interaction@v1.1.0 + with: + # Token for the repository. Can be passed in using {{ secrets.GITHUB_TOKEN }} + repo-token: + # Comment to post on an individual's first issue + issue-message: # optional + # Comment to post on an individual's first pull request + pr-message: # optional +