Files
utils/.github/workflows/build.yaml
ztimson e1f22a01a6
Some checks failed
Build / Build NPM Project (push) Successful in 31s
Build / Tag Version (push) Successful in 7s
Build / Publish Documentation (push) Failing after 5s
Added docs container
2024-10-01 15:08:52 -04:00

97 lines
2.9 KiB
YAML

name: Build
run-name: Build
on:
- push
- pull_request
jobs:
build:
name: Build NPM Project
runs-on: ubuntu-latest
container: node:20-alpine
steps:
- name: Clone Repository
uses: ztimson/actions/clone@develop
- name: Install & Build
run: |
npm i
npm run build
- name: Test
run: npm run test:coverage
- name: Upload to Registry
uses: ztimson/actions/npm/publish@develop
- name: Upload to NPM
uses: ztimson/actions/npm/publish@develop
with:
owner: ztimson
registry: https://registry.npmjs.org/
token: ${{secrets.NPM_TOKEN}}
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}}
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 server/package.json ]] && echo "VERSION=$(cat server/package.json | grep version | grep -Eo ':.+' | grep -Eo '[[:alnum:]\.\/\-]+')" >> $GITHUB_ENV
- 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