Update .github/workflows/build.yaml
All checks were successful
Build / Build NPM Project (push) Successful in 44s
Build / Tag Version (push) Successful in 6s
Build / Publish (push) Successful in 12s

This commit is contained in:
Zakary Timson 2024-01-07 21:58:24 +00:00
parent a567e3782c
commit 901bdff0a5

View File

@ -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}}