add caching & use single wf & steps

This commit is contained in:
jem 2020-06-29 17:35:04 +02:00
parent 8ceded6122
commit ba065753b2
3 changed files with 70 additions and 55 deletions

View file

@ -1,5 +1,4 @@
name: Node.js CI
name: release dev
on:
push:
tags: '![0-9]+.[0-9]+.[0-9]+'
@ -14,37 +13,38 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install -g --save-dev shadow-cljs
- run: shadow-cljs compile test
run: npm install
run: npm install -g --save-dev shadow-cljs
run: shadow-cljs compile test
release-build-dev:
name: release dev
needs: test-matrix
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
- name: build release with node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install -g --save-dev shadow-cljs
- run: shadow-cljs release app
- run: rm -rf target/npm-build
- run: mkdir -p target/npm-build
- run: cp mastodon-bot.js target/npm-build/
- run: cp package.json target/npm-build/
- run: cp README.md target/npm-build/
- run: tar -cz -C target/npm-build -f target/npm-build.tgz .
run: shadow-cljs release app
run: mkdir -p target/npm-build
run: cp mastodon-bot.js target/npm-build/
run: cp package.json target/npm-build/
run: cp README.md target/npm-build/
run: tar -cz -C target/npm-build -f target/npm-build.tgz .
- name: Create Release
id: create_release
@ -56,6 +56,7 @@ jobs:
release_name: Release ${{ github.ref }}
draft: false
prerelease: true
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
@ -66,4 +67,3 @@ jobs:
asset_path: ./mastodon-bot.js
asset_name: mastodon-bot.js
asset_content_type: application/json

View file

@ -1,4 +1,4 @@
name: Node.js CI
name: release prod
on:
push:
@ -14,37 +14,38 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install -g --save-dev shadow-cljs
- run: shadow-cljs compile test
run: npm install
run: npm install -g --save-dev shadow-cljs
run: shadow-cljs compile test
release-build-dev:
name: release dev
needs: test-matrix
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
- name: build release with node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install -g --save-dev shadow-cljs
- run: shadow-cljs release app
- run: rm -rf target/npm-build
- run: mkdir -p target/npm-build
- run: cp mastodon-bot.js target/npm-build/
- run: cp package.json target/npm-build/
- run: cp README.md target/npm-build/
- run: tar -cz -C target/npm-build -f target/npm-build.tgz .
run: shadow-cljs release app
run: mkdir -p target/npm-build
run: cp mastodon-bot.js target/npm-build/
run: cp package.json target/npm-build/
run: cp README.md target/npm-build/
run: tar -cz -C target/npm-build -f target/npm-build.tgz .
- name: Create Release
id: create_release
@ -56,6 +57,7 @@ jobs:
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
@ -66,4 +68,3 @@ jobs:
asset_path: ./mastodon-bot.js
asset_name: mastodon-bot.js
asset_content_type: application/json

View file

@ -1,4 +1,4 @@
name: Node.js CI
name: test PR
on:
pull_request:
@ -14,10 +14,24 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install -g --save-dev shadow-cljs
- run: shadow-cljs compile test
run: npm install
run: npm install -g --save-dev shadow-cljs
run: shadow-cljs compile test