Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(cd): add github packages publish job #262

Merged
merged 6 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
"plugin:jsdoc/recommended",
"plugin:promise/recommended",
"plugin:regexp/recommended",
"plugin:security/recommended",
"plugin:security/recommended-legacy",
"prettier",
],
overrides: [
Expand Down
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

79 changes: 0 additions & 79 deletions .github/ISSUE_TEMPLATE/bug_report.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/ISSUE_TEMPLATE/feature_request.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md

This file was deleted.

60 changes: 50 additions & 10 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ on:
# Allows this workflow to be run manually from the Actions tab
workflow_dispatch:

permissions:
contents: write
id-token: write
pull-requests: write

jobs:
release:
name: Create/Update Release Pull Request
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
release_created: ${{ steps.release.outputs.release_created }}
steps:
- name: Release Please
id: release
Expand All @@ -29,24 +29,64 @@ jobs:
release-type: node
package-name: fastify-disablecache

publish-npm:
name: Publish to NPM
needs: release
if: needs.release.outputs.release_created == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Check out repo
if: steps.release.outputs.release_created
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node
if: steps.release.outputs.release_created
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org/
registry-url: https://registry.npmjs.org

- name: Publish to NPM
if: steps.release.outputs.release_created
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Remove dev values from package.json
# Remove dev values from package.json before publishing to reduce package size
run: |
npm pkg delete commitlint devDependencies jest scripts
npm publish --ignore-scripts --provenance

publish-ghp:
name: Publish to GitHub Packages
needs: release
if: needs.release.outputs.release_created == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://npm.pkg.github.com
scope: "@fdawgs"

- name: Scope package
run: |
pkgName=$(npm pkg get name | tr -d '"')
npm pkg set name="@fdawgs/$pkgName"

- name: Publish to GitHub Packages
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Remove dev values from package.json before publishing to reduce package size
run: |
npm pkg delete commitlint devDependencies jest scripts
npm publish --ignore-scripts
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint:prettier && npm run lint:licenses && npm test
npm run lint:licenses && npm test
127 changes: 0 additions & 127 deletions CODE_OF_CONDUCT.md

This file was deleted.

Loading