Skip to content

Commit

Permalink
feat: add ship.js for automated releases ⛴️
Browse files Browse the repository at this point in the history
Signed-off-by: Vinayak Kulkarni <[email protected]>
  • Loading branch information
Vinayak Kulkarni committed Apr 29, 2024
1 parent 57125ae commit e797f3c
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Token required for automated releases using ship.js
GITHUB_TOKEN=
45 changes: 45 additions & 0 deletions .github/workflows/shipjs-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Ship js trigger
on:
pull_request:
types:
- closed

permissions:
contents: write
packages: write

jobs:
build:
name: Release
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v')
steps:
- name: Checkout code 🛎
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main

- name: Setup GitHub Actor
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
- name: Setup node environment 📦
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
check-latest: true
cache: 'npm'
registry-url: https://npm.pkg.github.com/
scope: '@dscvr-one'

- name: Install dependencies 🚀
run: npm ci --prefer-offline --no-audit

- name: Trigger a release 🥳
run: npx shipjs trigger
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
"lint:eslint": "eslint \"{,!(node_modules|dist)/**/}*.{js,cjs,mjs,ts}\" --ignore-path .gitignore",
"lint:eslint:fix": "eslint --fix \"{,!(node_modules|dist)/**/}*.{js,cjs,mjs,ts}\" --ignore-path .gitignore",
"lint:prettier": "prettier --check \"{,!(node_modules|dist)/**/}*.{js,cjs,mjs,ts}\" --ignore-path .gitignore",
"lint:prettier:fix": "prettier --write \"{,!(node_modules|dist)/**/}*.{js,cjs,mjs,ts}\" --ignore-path .gitignore"
"lint:prettier:fix": "prettier --write \"{,!(node_modules|dist)/**/}*.{js,cjs,mjs,ts}\" --ignore-path .gitignore",
"release": "shipjs prepare",
"release:dry": "shipjs prepare --dry-run",
"release:auto": "shipjs prepare --yes"
},
"dependencies": {
"abort-controller": "^3.0.0",
Expand Down
3 changes: 3 additions & 0 deletions ship.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
installCommand: () => 'npm i --prefer-offline --no-audit',
};

0 comments on commit e797f3c

Please sign in to comment.