Skip to content

Commit

Permalink
Merge pull request #1 from CUCWD/feature.maple/ztraboo/add-npm-publis…
Browse files Browse the repository at this point in the history
…h-workflow

Install mfe runtime changes for `frontend-build` and `frontend-platform` and create `npm-publish` Github workfllow.
  • Loading branch information
ztraboo authored Oct 29, 2022
2 parents e2f9299 + a458cea commit 5ca9038
Show file tree
Hide file tree
Showing 8 changed files with 31,069 additions and 13,071 deletions.
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ LOGO_URL=https://edx-cdn.org/v3/default/logo.svg
LOGO_TRADEMARK_URL=https://edx-cdn.org/v3/default/logo-trademark.svg
LOGO_WHITE_URL=https://edx-cdn.org/v3/default/logo-white.svg
FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico
MFE_CONFIG_API_URL='http://localhost:18000/api/v1/mfe_config'
APP_ID='learning'
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Default CI
on: [push, pull_request]

env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

jobs:
build:
runs-on: ubuntu-latest
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# 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://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]

env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js Env
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV

- name: Setup Node.js
uses: dcodeIO/setup-node-nvm@v4
with:
node-version: "${{ env.NODE_VER }}"

- name: Install dependencies
run: npm ci

- name: Create Build
run: npm run build

publish-npm:
needs: build
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js Env
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV

- name: Setup Node.js
uses: dcodeIO/setup-node-nvm@v4
with:
node-version: "${{ env.NODE_VER }}"

- name: Install dependencies
run: npm ci

- name: Validate package-lock.json changes
run: make validate-no-uncommitted-package-lock-changes

- name: Lint
run: npm run lint

- name: Test
run: npm run test

- name: i18n_extract
run: npm run i18n_extract

- name: Coverage
uses: codecov/codecov-action@v2

- name: Create Build
run: npm run build

- run: git config --global user.name "${{ github.actor }}"
- run: git config --global user.email "github-action-${{ github.actor }}@users.noreply.github.com"

- name: Tag NPM version
run: npm version --allow-same-version ${{ github.event.release.tag_name }}

- name: Publishing to npmjs.
run: npm publish --userconfig .npmrc --registry https://registry.npmjs.org/

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12
Loading

0 comments on commit 5ca9038

Please sign in to comment.