Skip to content

Commit

Permalink
Merge pull request #3 from nordnet/semantic-release
Browse files Browse the repository at this point in the history
chore: proper release flow
  • Loading branch information
JohnLindahlTech authored Dec 27, 2023
2 parents cedc9ad + 9aa480a commit 1b0db6e
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 18 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Release

on:
push:
branches:
- master
- beta
pull_request:

env:
CI: true
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

jobs:
validate:
name: "Validate"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"

- name: Install dependencies
run: npm ci

# - name: Run eslint
# run: npm run lint:js

# - name: Run stylelint
# run: npm run lint:css

# - name: Run typescript checks
# run: npm run lint:ts

# - name: Run tests
# run: npm run test-ci

release:
name: "Release"
needs: validate
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"

- name: Node and npm version
run: node -v && npm -v

- name: Install dependencies
run: npm ci

- name: Release
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
run: npm run semantic-release

- name: Beta release
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/beta' }}
run: npm run semantic-release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
*.log
.npmrc
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.10.0
3 changes: 3 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"url": "https://github.com/nordnet/cz-conventional-changelog.git"
},
"scripts": {
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
"semantic-release": "semantic-release"
},
"publishConfig": {
"access": "public"
Expand All @@ -26,6 +26,9 @@
"word-wrap": "1.2.5"
},
"devDependencies": {
"@semantic-release/github": "^9.2.6",
"@semantic-release/npm": "^11.0.2",
"@semantic-release/release-notes-generator": "^12.1.0",
"semantic-release": "22.0.12"
}
}
8 changes: 8 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
branches: ["master"],
plugins: [
"@semantic-release/release-notes-generator",
"@semantic-release/github",
"@semantic-release/npm",
],
};
17 changes: 0 additions & 17 deletions release.sh

This file was deleted.

0 comments on commit 1b0db6e

Please sign in to comment.