utils/.github/workflows/build.yaml

97 lines
2.9 KiB
YAML
Raw Normal View History

2024-02-07 01:33:07 -05:00
name: Build
run-name: Build
on:
- push
- pull_request
jobs:
build:
name: Build NPM Project
runs-on: ubuntu-latest
2024-07-19 00:09:40 -04:00
container: node:20-alpine
2024-02-07 01:33:07 -05:00
steps:
- name: Clone Repository
uses: ztimson/actions/clone@develop
2024-07-19 00:08:39 -04:00
- name: Install & Build
2024-07-19 00:06:17 -04:00
run: |
2024-07-19 00:08:39 -04:00
npm i
2024-07-19 00:06:17 -04:00
npm run build
2024-02-28 23:57:20 -05:00
2024-02-07 01:33:07 -05:00
- name: Test
run: npm run test:coverage
2024-06-16 08:36:45 -04:00
- name: Upload to Registry
uses: ztimson/actions/npm/publish@develop
- name: Upload to NPM
uses: ztimson/actions/npm/publish@develop
2024-02-07 01:33:07 -05:00
with:
2024-06-16 08:36:45 -04:00
owner: ztimson
registry: https://registry.npmjs.org/
token: ${{secrets.NPM_TOKEN}}
2024-02-07 01:33:07 -05:00
tag:
name: Tag Version
needs: build
if: ${{github.ref_name}} == 'release'
runs-on: ubuntu-latest
container: node
steps:
- name: Clone Repository
uses: ztimson/actions/clone@develop
- name: Get Version Number
run: echo "VERSION=$(cat package.json | grep version | grep -Eo ':.+' | grep -Eo '[[:alnum:]\.\/\-]+')" >> $GITHUB_ENV
- name: Tag Version
uses: ztimson/actions/tag@develop
with:
tag: ${{env.VERSION}}
2024-10-01 15:08:52 -04:00
docs:
name: Publish Documentation
needs: build
runs-on: ubuntu-latest
container: docker
steps:
- name: Clone Repository
uses: ztimson/actions/clone@develop
- name: Get Version Number
shell: sh
run: |
[[ -f package.json ]] && echo "VERSION=$(cat package.json | grep version | grep -Eo ':.+' | grep -Eo '[[:alnum:]\.\/\-]+')" >> $GITHUB_ENV
2024-10-01 15:08:52 -04:00
- name: Push with branch tag
uses: ztimson/actions/docker/push@develop
with:
registry: ${{github.server_url}}
user: ${{github.repository_owner}}
pass: ${{secrets.DEPLOY_TOKEN}}
name: ${{github.repository}}
tag: ${{github.ref_name}}
- name: Push with version tag
uses: ztimson/actions/docker/push@develop
if: ${{env.VERSION}}
with:
from: "${{github.server_url}}/${{github.repository}}:${{github.ref_name}}"
registry: ${{github.server_url}}
user: ${{github.repository_owner}}
pass: ${{secrets.DEPLOY_TOKEN}}
name: ${{github.repository}}
tag: ${{env.VERSION}}
- name: Push with latest tag
uses: ztimson/actions/docker/push@develop
if: ${{github.ref_name}} == (git symbolic-ref refs/remotes/origin/HEAD --short | cut -c 7)
with:
from: "${{github.server_url}}/${{github.repository}}:${{github.ref_name}}"
registry: ${{github.server_url}}
user: ${{github.repository_owner}}
pass: ${{secrets.DEPLOY_TOKEN}}
name: ${{github.repository}}
tag: latest