This repository has been archived by the owner on Nov 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub workflows for autopublish (#68)
* Adopt 0.0.0 autopublish convention. * Eliminate CircleCI configuration * Upgrade aslant + friends * Add package auto-publication magic * Avoid double workflows * Upgrade to NodeJS 18 * Add NPM publication * Add Cypress version to test matrix
- Loading branch information
Showing
11 changed files
with
1,783 additions
and
1,735 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,59 @@ | ||
# Reusable publish workflow for open-source NPM packages | ||
# - dual publication (to NPM, then GitHub) | ||
# - single package per repo (no mono-repo support) | ||
name: publish | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
name: publish | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
- name: Establish Version | ||
run: | | ||
release='${{ github.event.release.tag_name }}' | ||
version=`echo $release | cut -b2-` | ||
if ! echo $release | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+(-.+)?$'; then | ||
echo "Release name must be in the format of 'vX.Y.Z[-anything]', got '$release'" | ||
exit 1 | ||
fi | ||
sed -i -r "s/\"version\": *\".+\"/\"version\": \"$version\"/" package.json | ||
- name: Install Dependencies | ||
run: npm ci | ||
- name: Build Distributables | ||
run: npm run build | ||
- name: Publish to NPM | ||
run: | | ||
touch $HOME/.npmrc | ||
chmod 0600 $HOME/.npmrc | ||
cat << EOF > ~/.npmrc | ||
//registry.npmjs.org/:_authToken=${NPM_TOKEN} | ||
@appfolio:registry=https://registry.npmjs.org/ | ||
EOF | ||
npm publish --workspaces | ||
env: | ||
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}" | ||
- name: Publish to GitHub | ||
run: | | ||
touch $HOME/.npmrc | ||
chmod 0600 $HOME/.npmrc | ||
cat << EOF > ~/.npmrc | ||
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN} | ||
@appfolio-im:registry=https://npm.pkg.github.com/ | ||
EOF | ||
npm publish | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: test | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
cypress-version: ["11", "12"] | ||
node-version: ["16.x", "18.x"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm ci | ||
- run: npm install --save=false cypress@${{ matrix.cypress-version }} | ||
- run: npm test |
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 @@ | ||
nodejs 18.12.1 |
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
Oops, something went wrong.