Skip to content

Commit

Permalink
build(actions): add nightly build action
Browse files Browse the repository at this point in the history
Add an action to run a nightly build at 22:00 UTC everyday and publish it to npm with the nightly tag.

This will allow users to use `npm install fomantic-ui@nightly` to use the latest features early.
  • Loading branch information
Sean committed Oct 18, 2019
1 parent c629516 commit 8eb1705
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: pre-install
run: sh preinstall.sh
run: sh ./scripts/preinstall.sh
- name: install dependencies
run: npm install --ignore-scripts
- name: pre fomantic install & gulp build
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Nightly
on:
schedule:
- cron: 0 22 * * *
jobs:
build:
name: Build nightly distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
ref: develop
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: pre-setup
run: sh ./scripts/preinstall.sh
- name: install dependencies
run: npm install --ignore-scripts
- name: fomantic install & gulp build
run: npx gulp install
- name: update nightly version
run: node ./scripts/nightly-version.js
- name: publish to npm
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
run: npm publish --tag nightly
4 changes: 3 additions & 1 deletion package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
},
"devDependencies": {
"all-contributors-cli": "^6.7.0",
"auto-changelog": "^1.15.0"
"auto-changelog": "^1.15.0",
"node-fetch": "^2.6.0"
},
"engines": {
"node": ">=10.15.3",
Expand Down
27 changes: 27 additions & 0 deletions scripts/nightly-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// node
const fs = require('fs')
const path = require('path')

// npm
const fetch = require('node-fetch')

// pkg
const pkg = require('../package.json')

const ghBase = 'https://api.github.com'
const repoUrlPath = 'fomantic/Fomantic-UI'

const run = async function () {
return fetch(`${ghBase}/repos/${repoUrlPath}/milestones`)
.then(r => r.json())
.then(milestones => milestones.filter(m => m.title.indexOf('x') === -1)[0].title)
}

run()
.then(nextVersion => {
pkg.version = nextVersion
})
.then(() => {
fs.writeFileSync(path.resolve(__dirname, '../package.json'), JSON.stringify(pkg, null, 2))
})
.then(() => console.log('Done'))
File renamed without changes.

0 comments on commit 8eb1705

Please sign in to comment.