Skip to content

Commit

Permalink
Add actions for building project and types
Browse files Browse the repository at this point in the history
  • Loading branch information
jpshilton-op committed Aug 28, 2023
1 parent ba1ac6f commit 2b752f8
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build-and-publish-typescript-project-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build Application

on:
workflow_call:
secrets:
token:
description: 'The GitHub/npm token'
required: true

jobs:
getver:
uses: OpenPhone/gha/.github/workflows/getver@jpTest

build-types:
name: Build and Publish Types
runs-on: ubuntu-22.04
needs: getver
if: github.event_name == 'push'
defaults:
run:
working-directory: ./types
steps:
- uses: OpenPhone/gha/.github/workflows/build-typescript-project-types.yml@jpTest
- name: Set Version
run: npm version "${{ needs.getver.outputs.version }}" --no-git-tag-version --no-commit-hooks
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GPR_ACCESS_TOKEN}}
25 changes: 25 additions & 0 deletions .github/workflows/build-and-publish-typescript-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build Application

on:
workflow_call:
secrets:
token:
description: 'The GitHub/npm token'
required: true

jobs:
getver:
uses: OpenPhone/gha/.github/workflows/getver@jpTest

build:
name: Build and Publish Types
runs-on: ubuntu-22.04
needs: getver
if: github.event_name == 'push'
steps:
- uses: OpenPhone/gha/.github/workflows/build-typescript-project.yml@jpTest
- name: Set Version
run: npm version "${{ needs.getver.outputs.version }}" --no-git-tag-version --no-commit-hooks
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GPR_ACCESS_TOKEN}}
29 changes: 29 additions & 0 deletions .github/workflows/build-typescript-project-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build Types

on:
workflow_call:
secrets:
token:
description: 'The GitHub/npm token'
required: true

jobs:
build-types:
name: Build Types
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./types
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: https://npm.pkg.github.com/
scope: '@openphone'
cache: npm
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{secrets.token}}
- run: npm run build
- run: npm run test
40 changes: 40 additions & 0 deletions .github/workflows/build-typescript-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build Application

on:
workflow_call:
secrets:
token:
description: 'The GitHub/npm token'
required: true

jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Setup node 18
uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: https://npm.pkg.github.com/
scope: '@openphone'

- uses: actions/checkout@v3

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}

- name: Run CI
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
env:
NODE_AUTH_TOKEN: ${{secrets.token}}

- run: npm run lint
- run: npm run typecheck
- run: npm run build
- run: node .
18 changes: 18 additions & 0 deletions .github/workflows/getsha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Get Version From Tag

on:
workflow_call:
secrets:
token:
description: 'The GitHub/npm token'
required: true

jobs:
getsha:
runs-on: ubuntu-22.04
name: Get short sha
outputs:
sha: ${{ steps.short_sha.outputs.sha }}
steps:
- id: short_sha
run: echo "sha=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
19 changes: 19 additions & 0 deletions .github/workflows/getver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Get Version From Tag

on:
workflow_call:
secrets:
token:
description: 'The GitHub/npm token'
required: true

jobs:
getver:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-22.04
name: Get version from tag
outputs:
version: ${{ steps.vertag.outputs.version }}
steps:
- id: vertag
run: echo "version=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_OUTPUT

0 comments on commit 2b752f8

Please sign in to comment.