Skip to content

Commit de1fe4b

Browse files
Publish package workflow (#3)
* Skeleton for workflows * use resource that is currently in this branch * npm push conditionally * endline * job names * Prepared to main
1 parent 4e2906b commit de1fe4b

File tree

4 files changed

+58
-20
lines changed

4 files changed

+58
-20
lines changed

.github/workflows/build-main.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Build and Publish
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
build-and-push:
8+
uses: elastic-ipfs/core-lib/.github/workflows/package-shared-build.yaml@main
9+
with:
10+
npm_push: true
11+
secrets:
12+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/ci.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 'Shared build flow'
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
npm_push:
7+
type: boolean
8+
description: Whether to push after build
9+
required: false
10+
secrets:
11+
NPM_TOKEN:
12+
required: false
13+
description: Only required if pushing no npm
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
node-version: [18.12]
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
registry-url: 'https://registry.npmjs.org'
27+
- name: Install Dependencies
28+
run: npm install --ignore-scripts
29+
- name: Lint
30+
run: npm run lint
31+
- name: Test
32+
run: npm run test:ci
33+
- run: npm publish
34+
if: inputs.npm_push
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/pr.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: PR | Build
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
jobs:
7+
build:
8+
uses: elastic-ipfs/core-lib/.github/workflows/package-shared-build.yaml@main
9+
with:
10+
npm_push: false

0 commit comments

Comments
 (0)