Skip to content

Commit

Permalink
ci: add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
okikio committed Jan 1, 2023
1 parent ffaa9f0 commit 34a8ffc
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 3 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release
on: workflow_dispatch

jobs:
release:
name: Release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
# File containing the version Spec of the version to use. Examples: .nvmrc, .node-version, .tool-versions.
node-version: 18

- name: Install
run: |
npm install
- name: Pre-release
run: npm run build

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run semantic-release

- name: Add lib, types and docs to Git
if: ${{ github.ref == 'refs/heads/master' }}
run: |
git add --force dist
- name: Commit files
if: ${{ github.ref == 'refs/heads/master' }}
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "chore(gh-bot): :rocket: release" -a
- name: Push changes
if: ${{ github.ref == 'refs/heads/master' }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
59 changes: 56 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"version": "0.0.0",
"name": "resolve.imports",
"repository": "okikio/resolve.imports",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/okikio/resolve.imports.git"
},
"description": "A tiny (613b), correct, general-purpose, and configurable subpath \"imports\" resolver without file-system reliance (forked from @lukeed's `resolve.exports`)",
"module": "dist/index.mjs",
"main": "dist/index.js",
Expand All @@ -12,12 +16,16 @@
"email": "[email protected]",
"url": "https://okikio.dev"
},
"bugs": {
"url": "https://github.com/okikio/resolve.imports/issues"
},
"engines": {
"node": ">=10"
},
"scripts": {
"build": "bundt",
"test": "uvu -r esm test"
"test": "uvu -r esm test",
"semantic-release": "semantic-release"
},
"files": [
"*.d.ts",
Expand All @@ -43,6 +51,51 @@
"devDependencies": {
"bundt": "1.1.2",
"esm": "3.2.25",
"uvu": "0.5.1"
"uvu": "0.5.1",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"husky": "^8.0.1",
"semantic-release": "^19.0.5"
},
"release": {
"branches": [
"main",
"master"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/git",
"@semantic-release/npm",
[
"@semantic-release/github",
{
"assets": [
"*.d.ts",
"dist"
]
}
]
]
},
"changelog": {
"repo": "resolve.imports",
"labels": {
"breaking": ":boom: Breaking Change",
"enhancement": ":rocket: Enhancement",
"bug": ":bug: Bug Fix",
"documentation": ":memo: Documentation",
"internal": ":house: Internal",
"revert": ":rewind: Revert"
},
"cacheDir": ".changelog"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS --verbose"
}
}
}

0 comments on commit 34a8ffc

Please sign in to comment.