Skip to content

Commit

Permalink
ci: semantic release added
Browse files Browse the repository at this point in the history
  • Loading branch information
hayes committed Apr 26, 2021
1 parent 9d90da3 commit 56b7be1
Show file tree
Hide file tree
Showing 5 changed files with 1,735 additions and 101 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Shopify Packer
name: Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

Expand All @@ -18,8 +16,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}

- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ matrix.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
Expand All @@ -31,7 +34,7 @@ jobs:
run: npm run lint


test:
release:
name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}
runs-on: ${{ matrix.os }}

Expand All @@ -42,8 +45,13 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}

- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ matrix.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
Expand All @@ -52,4 +60,4 @@ jobs:
run: yarn install --frozen-lockfile

- name: Run tests
run: npm test
run: npm test
45 changes: 0 additions & 45 deletions .github/workflows/npm-publish.yml

This file was deleted.

70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI

on:
push:
branches: [ master ]

jobs:
lint:
name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }}

strategy:
matrix:
os: [ ubuntu-latest ]
node-version: [ 12.x ]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2


- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ matrix.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: npm run lint


release:
name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ matrix.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run tests
run: npm test

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn run semantic-release
40 changes: 36 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hayes0724/shopify-packer",
"version": "2.1.5",
"version": "0.0.0-development",
"bin": {
"packer": "cli/index.js"
},
Expand All @@ -27,8 +27,7 @@
"test": "jest",
"lint": "eslint --ext .js src/** cli/**",
"lint:fix": "eslint --ext .js --fix src/** cli/**",
"preversion": "npm test && npm run lint",
"version": "conventional-changelog -n changelog/index.js -i CHANGELOG.md --same-file"
"semantic-release": "semantic-release"
},
"dependencies": {
"@babel/core": "^7.13.10",
Expand Down Expand Up @@ -85,6 +84,8 @@
"yargs": "^16.2.0"
},
"devDependencies": {
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"babel-jest": "^26.3.0",
"conventional-changelog": "^3.1.23",
"eslint-config-prettier": "^8.1.0",
Expand All @@ -93,7 +94,8 @@
"jest": "^26.4.2",
"lerna-changelog": "^1.0.1",
"mock-fs": "^4.13.0",
"prettier-eslint": "^12.0.0"
"prettier-eslint": "^12.0.0",
"semantic-release": "^17.4.2"
},
"prettier": {
"singleQuote": true,
Expand All @@ -114,5 +116,35 @@
"config": ":wrench Config"
},
"cacheDir": ".changelog"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"tag": "latest",
"access": "public"
},
"release": {
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": [
"package.json",
"package-lock.json",
"CHANGELOG.md"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
}
Loading

0 comments on commit 56b7be1

Please sign in to comment.