Skip to content

Commit

Permalink
build: add artifact and publish to npm in build fp-38 (#80)
Browse files Browse the repository at this point in the history
* build: add build ts config fp-38

* build: add publish step to cd action fp-38
  • Loading branch information
what1s1ove authored Dec 7, 2023
1 parent 88f8b53 commit 9c5089b
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 9 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
env:
ARTIFACT_NAME: dist
ARTIFACT_PATH: ./dist

name: Continuous Delivery

on:
Expand Down Expand Up @@ -27,3 +31,84 @@ jobs:
uses: google-github-actions/release-please-action@v3
with:
command: manifest

dependencies:
name: Install Dependencies
needs: release
if: ${{ needs.release.outputs.release_created }}
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v4

- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- name: Cache Dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: cd-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
cd-
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install

build:
name: Build
needs: dependencies
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v4

- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- name: Restore Dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: cd-${{ hashFiles('**/package-lock.json') }}

- name: Code Building
run: npm run build

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_PATH }}

npm-publish:
name: NPM Publish
needs: build
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v4

- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: 'https://registry.npmjs.org'

- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_PATH }}

- name: Publish
working-directory: ${{ env.ARTIFACT_PATH }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 1 addition & 2 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ jobs:
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm install
run: npm install

lint:
name: Pull Request Linting
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ jobs:
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm install
run: npm install

lint:
name: Code Linting
Expand All @@ -56,8 +55,7 @@ jobs:
key: ci-${{ hashFiles('**/package-lock.json') }}

- name: Code Linting
run: |
npm run ci:lint
run: npm run ci:lint

test:
name: Code Testing
Expand All @@ -79,5 +77,4 @@ jobs:
key: ci-${{ hashFiles('**/package-lock.json') }}

- name: Code Testing
run: |
npm run ci:test
run: npm run ci:test
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
node_modules

# build
build
dist
9 changes: 9 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"include": ["src"],
"compilerOptions": {
"declaration": true,
"outDir": "dist/src",
"declarationMap": true
}
}

0 comments on commit 9c5089b

Please sign in to comment.