-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separated release workflow from testing and building
- Loading branch information
Showing
3 changed files
with
67 additions
and
22 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: release | ||
on: | ||
release: | ||
types: [created] | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout the exact commit tagged on the release. | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.release.target_commitish }} | ||
|
||
# This is the action in this repo! 👇 | ||
# Note we set an `id` called `release`. We'll use that later... | ||
- name: Validate and extract release information | ||
id: release | ||
uses: manovotny/github-releases-for-automated-package-publishing-action@v2.0.1 | ||
|
||
# When setting the node version for publishing a release, it's also impotant | ||
# to set `always-auth` and `registry-url` too. I've encountered vauge errors | ||
# and publishing doesn't work unless they are supplied. | ||
# | ||
# This example is using NPM's registry. If you were publishing to GitHub's | ||
# Package registry, you'd use `https://npm.pkg.github.com` instead. | ||
- name: Set node version | ||
uses: actions/setup-node@v3 | ||
with: | ||
always-auth: true | ||
node-version: '16.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
# Perform installs, run tests, run a build step, etc. here, as needed. | ||
|
||
# The last two steps will publish the package. Note that we're using | ||
# information from the `release` step above (I told you we'd use it | ||
# later). Notice the `if` statements on both steps... | ||
# | ||
# If there *is* a tag (ie. `beta`, `canary`, etc.), we publish a | ||
# "pre-release" or "tagged" version of a package (ie. 1.2.3-beta.1). | ||
# | ||
# If there *is not* a tag (ie. `beta`, `canary`, etc.), we publish a | ||
# version of a package (ie. 1.2.3). | ||
# | ||
# This example is using npm to publish, but you could just as easily | ||
# use yarn, if you prefer. It's also publishing to the NPM registry, | ||
# thus, it's using `NPM_TOKEN`, but you could just as easily use | ||
# `GITHUB_TOKEN` if you were publishing to the GitHub Package registry. | ||
|
||
# This will publish a "pre-release" or "tagged" version of a package. | ||
|
||
# This will publish a version of a package. | ||
- name: Publish version | ||
if: steps.release.outputs.tag == '' | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Publish tagged version | ||
if: steps.release.outputs.tag != '' | ||
run: npm publish --tag ${{ steps.release.outputs.tag }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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