Update .github/workflows/build.yaml
This commit is contained in:
parent
a567e3782c
commit
901bdff0a5
172
.github/workflows/build.yaml
vendored
172
.github/workflows/build.yaml
vendored
@ -1,86 +1,86 @@
|
|||||||
name: Build
|
name: Build
|
||||||
run-name: Build
|
run-name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
- push
|
- push
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build NPM Project
|
name: Build NPM Project
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: node
|
image: node
|
||||||
volumes:
|
volumes:
|
||||||
- '/mnt/swarm/gitea/runner/cache:/cache'
|
- '/mnt/swarm/gitea/runner/cache:/cache'
|
||||||
steps:
|
steps:
|
||||||
- name: Clone Repository
|
- name: Clone Repository
|
||||||
uses: ztimson/actions/clone@develop
|
uses: ztimson/actions/clone@develop
|
||||||
|
|
||||||
- name: Restore node_modules
|
- name: Restore node_modules
|
||||||
uses: ztimson/actions/cache/restore@develop
|
uses: ztimson/actions/cache/restore@develop
|
||||||
with:
|
with:
|
||||||
key: node_modules
|
key: node_modules
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm i
|
run: npm i
|
||||||
|
|
||||||
- name: Build Project
|
- name: Build Project
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: npm run test:coverage
|
run: npm run test:coverage
|
||||||
|
|
||||||
- name: Cache node_modules
|
- name: Cache node_modules
|
||||||
uses: ztimson/actions/cache@develop
|
uses: ztimson/actions/cache@develop
|
||||||
with:
|
with:
|
||||||
key: node_modules
|
key: node_modules
|
||||||
pattern: node_modules
|
pattern: node_modules
|
||||||
|
|
||||||
- name: Cache Artifacts
|
- name: Cache Artifacts
|
||||||
uses: ztimson/actions/cache@develop
|
uses: ztimson/actions/cache@develop
|
||||||
with:
|
with:
|
||||||
pattern: dist
|
pattern: dist
|
||||||
tag:
|
tag:
|
||||||
name: Tag Version
|
name: Tag Version
|
||||||
needs: build
|
needs: build
|
||||||
if: ${{github.ref_name}} == 'release'
|
if: ${{github.ref_name}} == 'release'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: node
|
container: node
|
||||||
steps:
|
steps:
|
||||||
- name: Clone Repository
|
- name: Clone Repository
|
||||||
uses: ztimson/actions/clone@develop
|
uses: ztimson/actions/clone@develop
|
||||||
|
|
||||||
- name: Get Version Number
|
- name: Get Version Number
|
||||||
run: echo "VERSION=$(cat package.json | grep version | grep -Eo ':.+' | grep -Eo '[[:alnum:]\.\/\-]+')" >> $GITHUB_ENV
|
run: echo "VERSION=$(cat package.json | grep version | grep -Eo ':.+' | grep -Eo '[[:alnum:]\.\/\-]+')" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Tag Version
|
- name: Tag Version
|
||||||
uses: ztimson/actions/tag@develop
|
uses: ztimson/actions/tag@develop
|
||||||
with:
|
with:
|
||||||
tag: ${{env.VERSION}}
|
tag: ${{env.VERSION}}
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
name: Publish
|
name: Publish
|
||||||
needs: build
|
needs: build
|
||||||
if: ${{github.ref_name}} == 'release'
|
if: ${{github.ref_name}} == 'release'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: node
|
image: node
|
||||||
volumes:
|
volumes:
|
||||||
- '/mnt/swarm/gitea/runner/cache:/cache'
|
- '/mnt/swarm/gitea/runner/cache:/cache'
|
||||||
steps:
|
steps:
|
||||||
- name: Clone Repository
|
- name: Clone Repository
|
||||||
uses: ztimson/actions/clone@develop
|
uses: ztimson/actions/clone@develop
|
||||||
|
|
||||||
- name: Restore Artifacts
|
- name: Restore Artifacts
|
||||||
uses: ztimson/actions/cache/restore@develop
|
uses: ztimson/actions/cache/restore@develop
|
||||||
|
|
||||||
- name: Upload to Registry
|
- name: Upload to Registry
|
||||||
uses: ztimson/actions/npm/publish@develop
|
uses: ztimson/actions/npm/publish@develop
|
||||||
|
|
||||||
- name: Upload to NPM
|
- name: Upload to NPM
|
||||||
uses: ztimson/actions/npm/publish@develop
|
uses: ztimson/actions/npm/publish@develop
|
||||||
with:
|
with:
|
||||||
owner: ztimson
|
owner: ztimson
|
||||||
registry: https://registry.npmjs.org
|
registry: https://registry.npmjs.org/
|
||||||
token: ${{secrets.NPM_TOKEN}}
|
token: ${{secrets.NPM_TOKEN}}
|
||||||
|
Loading…
Reference in New Issue
Block a user