Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DYN-2316] implement GitHub actions to publish librarie js npm package for every release #213

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:dev --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}}
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "dynamo-hosted-contents",
"name": "@dynamods/librarieJS",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Enzo707 Also it looks like there is no version info here so publish would not work correctly. You can use version 1.0.0

"version": "1.0.0",
"description": "Project that contains all hosted contents of Dynamo Windows client",
"main": "index.js",
"scripts": {
Expand Down
10 changes: 0 additions & 10 deletions pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@ ci_test:
format: "junit"
pattern: "*.xml"

deployment:
-
type: customized
customized_builder_image:
registry: artifactory
url: artifactory.dev.adskengineer.net/dynamo/dynamolibrariejs:dotnetcore3_node16_v2
scripts:
- "dotnet pack -c Release -o nuget --version-suffix \"beta$BUILD_NUMBER\""
- "dotnet nuget push \"$(find nuget -type f -name *.nupkg)\" -s https://api.nuget.org/v3/index.json -k $API_KEY"

soc2:
run_on_any_branch : true
harmony:
Expand Down
Loading