Skip to content

Commit

Permalink
Add release publish workflow (#4)
Browse files Browse the repository at this point in the history
* add release publish workflow

* update
  • Loading branch information
QilongTang authored Oct 6, 2022
1 parent d241443 commit a824fa5
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: PR Build

on:
push:
pull_request:
branches: ["master"]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci --force
- run: npm run build --if-present
# - run: npm test
47 changes: 47 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Publish release

on:
# uncomment the following if you need to debug manual trigger
# workflow_dispatch:
release:
types: [created]

jobs:
# Build dev first
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci --force
- run: npm run build --if-present
- run: npm test

# Build prod bundle and publish publicly
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci --force
- run: npm run production --if-present
- run: npm test
env:
# Set environment to production just in case
NODE_ENV: production
- name: The final publish step within dist folder
working-directory: dist
# This will publish the package and set access to public as if you had run npm access public after publishing.
run: npm publish --access public
env:
# Get npm token from Github
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,71 @@
# SplashScreen
Dynamo Splash Screen

[![License](https://img.shields.io/npm/l/@dynamods/splash-screen)](https://github.com/DynamoDS/SplashScreen/blob/master/LICENSE)

[![version](https://img.shields.io/npm/v/@dynamods/splash-screen?logo=npm&label=version)](https://www.npmjs.com/package/@dynamods/splash-screen)

[![Build](https://github.com/DynamoDS/SplashScreen/actions/workflows/build.yml/badge.svg)](https://github.com/DynamoDS/SplashScreen/actions/workflows/build.yml)

[![Publish](https://github.com/DynamoDS/SplashScreen/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/DynamoDS/SplashScreen/actions/workflows/npm-publish.yml)

Dynamo SplashScreen WebApp which is leveraged in Dynamo. This can also be leveraged by any products that needs a splash screen.

---

## Requirements

For development, you will only need Node.js and a node global package, installed in your environement.

### Node

- #### Node installation on Windows

Just go on [official Node.js website](https://nodejs.org/) and download the LTS installer. Also, be sure to have `git` available in your PATH, `npm` might need it (You can find git [here](https://git-scm.com/)).

- #### Node installation on Ubuntu

You can install nodejs and npm easily with apt install, just run the following commands.

sudo apt install nodejs
sudo apt install npm

- #### Other Operating Systems

You can find more information about the installation on the [official Node.js website](https://nodejs.org/) and the [official NPM website](https://npmjs.org/).

If the installation was successful, you should be able to run the following command (version outputs are just examples).

$ node --version
v16.16.0

$ npm --version
8.15.0

If you need to update `npm`, you can make it using `npm`!

npm install npm -g

---

## Install

git https://github.com/DynamoDS/SplashScreen
cd SplashScreen
npm install --force

## Running the project

npm run start

## Simple build for development

npm run build

## Simple build for production

npm run bundle

## Generate Third Party License Info
* to generate about box html files use `npm run generate_license`, this will output alternative about box files to `license_output/` One will contain the full transitive production dep list, the other will contain the direct production deps.
* These files will be packed into the released npm package
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
},
"scripts": {
"start": "webpack serve --config webpack.config.js",
"build": "webpack --config webpack.config.js --mode=production",
"build": "webpack --config webpack.config.js --mode=development",
"bundle": "webpack --config webpack.config.js --mode=production",
"copy": "cp package.json dist/ && cp README.md dist/ && cp -r license_output dist/",
"production": "npm run bundle && npm run copy",
"lic_direct": "npx @adsk/adsk-npm-license-puller --path . --app-name 'splash-screen' --verbose --about-box ./license_output/about-box_direct.html --about-box-type desktop --year 2022 --paos ./license_output/paos_direct.csv",
"lic_transitive": "npx @adsk/adsk-npm-license-puller --path . --app-name 'splash-screen' --verbose --about-box ./license_output/about-box_transitive.html --about-box-type desktop --transitive --year 2022 --paos ./license_output/paos_transitive.csv",
"generate_license": "npm run lic_direct && npm run lic_transitive",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Expand Down

0 comments on commit a824fa5

Please sign in to comment.