Skip to content

Commit

Permalink
ci: build and push new version to dist branch on push to master
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroentvb committed Feb 27, 2022
1 parent 3743d28 commit 1ddaf96
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 67 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Push new version to dist branch
on:
push:
branches:
- master

jobs:
deploy:
name: Push new version to dist branch
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 16.x
- name: npm install and build
run: |
npm ci
npm run build:prod
- name: Push new version
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: dist
FOLDER: package
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ dist
releases
*-export.*
*.old
exports
exports
package
195 changes: 130 additions & 65 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"watch-test": "jest --watch",
"watch": "tsc -w",
"test-dev": "node tests/dev-sandbox.js",
"build": "rm -rf ./dist && tsc"
"build": "rm -rf ./dist && tsc",
"build:prod": "npm run build && npm run package",
"package": "npm pack && node scripts/unpack.js"
},
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions scripts/unpack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const { name, version } = require('../package.json');
const { spawn } = require('child_process');

spawn(`tar -xzf ${name}-${version}.tgz`, { stdio: 'inherit', shell: true });

0 comments on commit 1ddaf96

Please sign in to comment.