Skip to content
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
27 changes: 27 additions & 0 deletions .github/scripts/pushdocs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

PAGES_USER="ibm-security-verify"
PAGES_REPO="ibm-security-verify.github.io"
PAGES_BRANCH="master"
DESTINATION_ROOT="${GITHUB_WORKSPACE}/docs"
SOURCE_ROOT="${GITHUB_WORKSPACE}/monorepo"

# generate privacy sdk docs
MODULE=privacy
DOC_TARGET_FOLDER="${DESTINATION_ROOT}/javascript/${MODULE}/docs"
mkdir -p "${DOC_TARGET_FOLDER}"
cd ${SOURCE_ROOT}/sdk/${MODULE} && npm i && npm run docs && cd -
cp -R ${SOURCE_ROOT}/sdk/${MODULE}/docs/. ${DOC_TARGET_FOLDER}/

# configure and push to github docs repo
cd ${SOURCE_ROOT}
MESSAGE=`git log --format=%B -n 1`
cd ${DESTINATION_ROOT}
# thanks to https://stackoverflow.com/a/64271581/5099773
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | \
xargs -L1 git config --unset-all
git config user.email "raghu4u449@gmail.com"
git config user.name "rramk"
git add -A
git diff-index --quiet HEAD || git commit -m "${MESSAGE}"
git push -u https://${PAGES_USER}:${GH_PAGES_TOKEN}@github.com/${PAGES_USER}/${PAGES_REPO}
30 changes: 30 additions & 0 deletions .github/workflows/publishpackage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish packages to NPM

on:
release:
types: [created]
push:
tags:
- '**'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
# Setup .npmrc file to publish
- uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Publish package to NPM
run: |
TAG=${GITHUB_REF:10}
MODULE=`echo "$TAG" | sed -e 's/@ibm-security-verify\/\([a-zA-Z].*\)@.*$/\1/'`
# This step would fail if module is not a valid sdk
cd ${GITHUB_WORKSPACE}/sdk/${MODULE}
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/pushdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Push documentation to github pages repo

env:
GH_PAGES_TOKEN: ${{ secrets.GH_PAGES_TOKEN }}

# Trigger the workflow on push to main or when a github release is created
on:
push:
branches:
- main
tags:
- '**'
release:
types: [created]

jobs:
pushdocs:
name: Push SDK documentation
runs-on: ubuntu-latest

steps:
- name: Checkout sdk monorepo
uses: actions/checkout@v2
with:
path: monorepo

- name: Checkout github docs repo
uses: actions/checkout@v2
with:
repository: ibm-security-verify/ibm-security-verify.github.io
path: docs

- name: Install npm
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Push docs
run: ${{ github.workspace }}/monorepo/.github/scripts/pushdocs.sh
shell: bash