Skip to content

Commit

Permalink
Merge pull request #11 from samcyn/feat/issue-doc-update
Browse files Browse the repository at this point in the history
ci(plugin): add semantic release library
  • Loading branch information
samcyn authored Apr 1, 2024
2 parents f25f180 + 38ed5c3 commit b9d97fe
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 30 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3 # Updated to the latest major version

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.9.0
node-version: '20.x'
registry-url: 'https://registry.npmjs.org/'
cache: 'yarn'

- name: Install dependencies
run: npm install
run: yarn install

- name: Cache Node Modules
uses: actions/cache@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Release
run: npx semantic-release
run: yarn release:plugin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish Project

on:
push:
branches: [ release ]
pull_request:
branches: [ release ]

jobs:
quality:

runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version: [20.x]
os: [ubuntu-latest]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn test

publish:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/release' }}
needs: [quality]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn release:plugin
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 10 additions & 23 deletions .github/workflows/update-main.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
name: Publish to npm with Yarn

name: main branch update
on:
push:
branches:
- main
pull_request:
branches:
- main

release:
types: [published]
jobs:
publish:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.9.0

- name: Install dependencies
run: npm install

- name: Run tests with Yarn
run: npm test
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn test
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"husky": "husky",
"commit": "commit",
"test": "vitest",
"coverage": "vitest run --coverage"
"coverage": "vitest run --coverage",
"release:plugin": "yarn workspace gatsby-source-hubspot-nodes semantic-release"
},
"packageManager": "[email protected]"
}
6 changes: 4 additions & 2 deletions packages/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"clean": "del-cli dist",
"build": "tsc",
"develop": "tsc --watch",
"prepare": "npm run clean && npm run build"
"prepare": "npm run clean && npm run build",
"semantic-release": "semantic-release --branches main"
},
"keywords": [
"gatsby",
Expand All @@ -29,6 +30,7 @@
"del-cli": "^5.1.0",
"gatsby": "^5.13.3",
"gatsby-plugin-utils": "^4.13.1",
"semantic-release": "^23.0.6",
"typescript": "^5.4.3"
},
"peerDependencies": {
Expand All @@ -39,6 +41,6 @@
},
"repository": {
"type": "git",
"url": "https://github.com/samcyn/gatsby-source-hubspot-nodes"
"url": "https://github.com/samcyn/gatsby-source-hubspot-nodes.git"
}
}

0 comments on commit b9d97fe

Please sign in to comment.