ci: publish package #409
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: Continuous Integration | |
on: | |
push: | |
branches: [fix/autocomplete-generate-display-label] | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ 16.x ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false # Make sure the release step uses its own credentials. | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
registry-url: 'https://npm.pkg.github.com/' | |
scope: '@zbmed' | |
- name: Run npm clean install | |
run: npm ci | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }} | |
- name: Run npm build | |
run: npm run build --if-present | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }} | |
- name: Capture version number | |
run: | | |
echo "SRVERSION=2.12.2" >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_TO_PUSH }} | |
NODE_AUTH_TOKEN: ${{ secrets.PAT_TO_PUSH }} | |
SCOPE: '@ts4nfdi' | |
- name: Run npm build:plainJS | |
run: npm run build:plainJS | |
- name: Set Git Author Identity | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
- name: Configure Git to Use PAT for Authentication | |
run: | | |
git config --global http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n '${{ secrets.GH_PAT }}' | base64)" | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: dist_plainjs | |
- name: Copy Version to gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npx gh-pages-multi deploy -s dist_plainjs --no-history -t js-modules/"2.12.2" | |
documentation: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://npm.pkg.github.com/' | |
scope: '@zbmed' | |
token: ${{ secrets.TREEVIEW_SECRET }} | |
- name: Run npm clean install | |
run: npm ci | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }} | |
- name: Run npm build:plainJS | |
run: npm run build:plainJS | |
- name: Install and Build HTML Storybook | |
run: | | |
npm install | |
npm run build-storybook-html -- -o html | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }} | |
- name: Upload html artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: 'html' | |
- name: Install and Build React Storybook | |
run: | | |
npm install | |
npm run build-storybook-react -- -o react | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }} | |
- name: Upload react artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: 'react' | |
- name: Install and Build Composed Storybook | |
run: | | |
npm install | |
npm run build-storybook -- -o public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.TREEVIEW_SECRET }} | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: 'public' | |
- name: Set Git Author Identity | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
- name: Configure Git to Use PAT for Authentication | |
run: | | |
git config --global http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n '${{ secrets.GH_PAT }}' | base64)" | |
- name: Use SRVERSION | |
env: | |
SRVERSION: 2.12.2 | |
run: echo "SRVERSION is $SRVERSION" | |
- name: Deploy Version to GitHub Pages | |
env: | |
SRVERSION: 2.12.2 | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npx gh-pages-multi deploy -s react --no-history -t react/"2.12.2" | |
npx gh-pages-multi deploy -s html --no-history -t html/"2.12.2" | |
npx gh-pages-multi deploy -s public --no-history -t comp/"2.12.2" | |