diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index aaeeaca..c957b9b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,3 +1,7 @@ +env: + ARTIFACT_NAME: dist + ARTIFACT_PATH: ./dist + name: Continuous Delivery on: @@ -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 }} diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index 10f887e..1947815 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ac60db..d5ba845 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -79,5 +77,4 @@ jobs: key: ci-${{ hashFiles('**/package-lock.json') }} - name: Code Testing - run: | - npm run ci:test + run: npm run ci:test diff --git a/.gitignore b/.gitignore index e2204b7..0c4db4f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ node_modules # build -build +dist diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..2e3b87f --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "include": ["src"], + "compilerOptions": { + "declaration": true, + "outDir": "dist/src", + "declarationMap": true + } +}