-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
121 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | ||
|
||
name: Dry Run - Publish to GitHub Package Registry | ||
on: | ||
push: | ||
paths: | ||
- '.github/workflows/publish-gpr**.yml' | ||
pull_request: | ||
paths: | ||
- '.github/workflows/publish-gpr**.yml' | ||
|
||
jobs: | ||
|
||
publish-gpr: | ||
name: Dry Run - Publish to GitHub Package Registry | ||
if: ${{ github.event_name != 'release' }} | ||
uses: ./.github/workflows/publish-gpr.yml |
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,19 @@ | ||
# https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | ||
|
||
name: On Release - Publish to GitHub Package Registry | ||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
|
||
run-tests: | ||
name: Run Tests | ||
if: ${{ github.event_name == 'release' }} | ||
uses: ./.github/workflows/run-tests.yml | ||
|
||
publish-gpr: | ||
name: Publish to GitHub Package Registry | ||
if: ${{ github.event_name == 'release' }} | ||
needs: run-tests | ||
uses: ./.github/workflows/publish-gpr.yml |
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,70 @@ | ||
# https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | ||
|
||
name: Callee - publish-gpr | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
|
||
publish-gpr: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
|
||
# https://github.com/actions/cache/blob/main/examples.md#node---npm | ||
- name: Get npm cache directory | ||
id: npm-cache-dir | ||
shell: bash | ||
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} | ||
|
||
# https://github.com/actions/cache/releases | ||
- name: Use cache for npm | ||
uses: actions/[email protected] | ||
id: npm-cache | ||
with: | ||
path: ${{ steps.npm-cache-dir.outputs.dir }} | ||
key: npm-${{ hashFiles('package.json') }} | ||
restore-keys: npm- | ||
|
||
# https://github.com/actions/checkout/releases | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Build package-lock | ||
run: npm i --package-lock-only | ||
|
||
# https://github.com/actions/setup-node/releases | ||
- name: Setup Node.js | ||
uses: actions/[email protected] | ||
with: | ||
node-version: latest | ||
registry-url: https://npm.pkg.github.com/ | ||
scope: '@Jashepp' | ||
|
||
- name: Clean & Install Deps | ||
run: npm ci | ||
|
||
- name: Run Final Tests | ||
run: npm test | ||
|
||
- name: Publish to GitHub Package Registry - Dry Run | ||
if: ${{ github.event_name != 'release' }} | ||
run: | | ||
npm config set scope "@Jashepp" | ||
npm config set @Jashepp:registry https://npm.pkg.github.com/ | ||
npm pkg set name=@Jashepp/eventemitter-wrapper | ||
npm publish --dry-run | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Publish to GitHub Package Registry | ||
if: ${{ github.event_name == 'release' }} | ||
run: | | ||
npm config set scope "@Jashepp" | ||
npm config set @Jashepp:registry https://npm.pkg.github.com/ | ||
npm pkg set name=@Jashepp/eventemitter-wrapper | ||
npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
19 changes: 15 additions & 4 deletions
19
.github/workflows/tests-on-push.yml → .github/workflows/run-tests.yml
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