v0.0.69 #83
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish NPM | |
on: | |
release: | |
types: [created] | |
env: | |
DIST_FOLDER: dist | |
PACKAGE_NAME_COMMON: ngds-common | |
PACKAGE_NAME_FORMS: ngds-forms | |
jobs: | |
package: | |
name: "Publish to NPM" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://registry.npmjs.org' | |
scope: "@digitalspace" | |
- uses: actions/cache@v3 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
### Install if no cache exists ### | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "yarn" | |
- run: yarn install --silent --frozen-lockfile | |
### Build if no cache exists ### | |
- name: Cache Build | |
id: cache-build | |
uses: actions/cache@v3 | |
with: | |
path: | | |
**/dist | |
key: ${{ github.sha }}-dist | |
- name: Run Build | |
if: steps.cache-build.outputs.cache-hit != 'true' | |
run: | | |
yarn build | |
yarn build $PACKAGE_NAME_FORMS | |
yarn build $PACKAGE_NAME_COMMON | |
### Config NPM Credentials | |
- run: | | |
git config --global user.email ${{ secrets.EMAIL }} | |
git config --global user.name ${{ secrets.USERNAME }} | |
### Publish NGDS-Forms | |
- run: | | |
cd $DIST_FOLDER/$PACKAGE_NAME_FORMS | |
npm version ${{ github.ref_name }} | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
### Publish NGDS-Common-Components | |
- run: | | |
cd $DIST_FOLDER/$PACKAGE_NAME_COMMON | |
npm version ${{ github.ref_name }} | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Deploy to Pages | |
run: | | |
yarn deploy | |
- name: Generate 404.html | |
uses: canastro/copy-file-action@master | |
with: | |
source: "dist/ngds-toolkit/index.html" | |
target: "dist/ngds-toolkit/404.html" | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@releases/v3 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: dist/ngds-toolkit |