Skip to content

Commit

Permalink
ci: setup automatic deployments
Browse files Browse the repository at this point in the history
Fixes #3
  • Loading branch information
christophka committed Oct 1, 2022
1 parent de38da8 commit 289fa18
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 6 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.pre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Pre Release
'on':
push:
# The branch name will specify the pre-release tag
branches:
- next
- beta
- alpha

env:
# Disable husky
HUSKY: 0

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm ci
# First run release
- name: Pre Release
run: npm run release -- --ci --preRelease=${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Then build
- run: npm run build:package
# Publish to NPM
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./dist/app-design/package.json
tag: ${{ github.ref_name }}
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release
'on':
push:
branches:
- '[0-9]+.x'

env:
# Disable husky
HUSKY: 0

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm ci
# First run release
- name: Release
run: npm run release -- --ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Then build
- run: npm run build:package
# Publish to NPM
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./dist/app-design/package.json
14 changes: 9 additions & 5 deletions .release-it.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ module.exports = {
// Follow conventional commit message format
commitMessage: 'chore: release ${version}',
// For now, the push should be done manually
push: false,
push: true,
// Release branches are most likely created before there is an upstream branch
requireUpstream: false,
// Tags are created after the release
tag: false,
requireUpstream: true,
// Create a tag
tag: true,
},
github: {
// Create a GitHub release
release: true,
},
npm: {
// We don't want to publish anything to npm
// We need to manually publish to NPM
publish: false,
},
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build:package": "npm run build app-design",
"watch": "ng build --watch --configuration development",
"test": "jest",
"test:coverage": "npm test -- --coverage",
"storybook:start": "ng run storybook:storybook",
"release": "release-it",
"release:pre": "release-it --preRelease",
"publish:components": "cd dist/app-design && npm publish",
"lint": "ng lint",
"prepare": "husky install"
Expand Down

0 comments on commit 289fa18

Please sign in to comment.