Skip to content

Commit

Permalink
build: release-it - bump/release flows
Browse files Browse the repository at this point in the history
  • Loading branch information
vio committed Aug 27, 2023
1 parent 4f05613 commit 2fe543c
Show file tree
Hide file tree
Showing 11 changed files with 6,933 additions and 359 deletions.
40 changes: 39 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
name: build-artifacts

- name: Setup local npm registry
run: ./scripts/setup-registry.sh
run: ./scripts/setup-registry.sh &

- name: Install test package dependencies
run: npm install
Expand All @@ -130,3 +130,41 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: exit 0

publish:
# Run only for version tags
if: contains(github.ref, 'refs/tags/v')
needs:
- tests
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3

# Cache packages when the branch is not update-dependencies or dependabot/*
- name: Resolve caching
id: cache
if: ${{ github.ref_name != 'update-dependencies' && !startsWith(github.ref_name, 'dependabot/') }}
run: echo "PACKAGE=npm" >> $GITHUB_OUTPUT

- name: Use Node.js
uses: actions/setup-node@v3.8.1
with:
node-version-file: ".nvmrc"
cache: ${{ steps.cache.outputs.PACKAGE }}
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Download build
uses: actions/download-artifact@v3
with:
name: build-artifacts

- run: npm run release
env:
NPM_CONFIG_PROVENANCE: true
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.DS_Store
node_modules
dist
.env
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.env
rollup.config.mjs
verdaccio.yml
tsconfig.json
config/**/*
scripts/**/*
test/**/*
10 changes: 10 additions & 0 deletions config/release-it/branch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const config = require('./common');

module.exports = {
...config,
git: {
...config.git,
// eslint-disable-next-line no-template-curly-in-string
commitMessage: 'DROP - release ${version}'
}
};
25 changes: 25 additions & 0 deletions config/release-it/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require('dotenv').config();

module.exports = {
git: {
commit: true,
// eslint-disable-next-line no-template-curly-in-string
commitMessage: ':package: release ${version}\n[ci skip]',
push: true,
requireUpstream: false,
tag: true,
// eslint-disable-next-line no-template-curly-in-string
tagName: 'v${version}'
},
npm: {
publish: false,
ignoreVersion: true,
allowSameVersion: true
},
github: {
draft: false,
release: false,
preRelease: false,
tokenRef: 'GITHUB_TOKEN'
}
};
20 changes: 20 additions & 0 deletions config/release-it/master.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const config = require('./common');

module.exports = {
...config,
git: {
...config.git,
// eslint-disable-next-line no-template-curly-in-string
commitMessage: ':package: release ${version}'
},
github: {
...config.github,
release: true
},
plugins: {
...config.plugins,
'@release-it/conventional-changelog': {
preset: 'angular'
}
}
};
17 changes: 17 additions & 0 deletions config/release-it/release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const config = require('./common');

module.exports = {
...config,
git: {
...config.git,
commit: false,
push: false,
tag: false,
requireCleanWorkingDir: false,
requireUpstream: false
},
npm: {
...config.npm,
publish: true
}
};
Loading

0 comments on commit 2fe543c

Please sign in to comment.