Skip to content

Continuous Integration #501

Continuous Integration

Continuous Integration #501

name: Continuous Integration
on: [ push, pull_request ]
jobs:
Build:
name: "Build"
runs-on: ubuntu-22.04
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Setup node"
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: "Install system dependencies"
run: sudo apt install graphviz zip
- name: "Cache Node.js modules"
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.OS }}-node18-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node18-
${{ runner.OS }}-
- name: "Install dependencies"
run: npm ci --no-progress
- name: "Lint"
run: npm run lint
- name: "Test"
run: npm test
- name: "Create .cache directory"
run: mkdir -p .cache
- name: "Create tmorin-plantuml-libs.zip"
run: zip -r ../.cache/tmorin-plantuml-libs.zip *
working-directory: distribution
- name: "Upload tmorin-plantuml-libs.zip"
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
.cache/tmorin-plantuml-libs.zip
GithubRelease:
name: "Github Release"
runs-on: ubuntu-22.04
needs: [ Build ]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Download all artifacts"
uses: actions/download-artifact@v3
- name: "Create the release"
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "artifacts/tmorin-plantuml-libs.zip"
omitName: true
omitBody: true
draft: false
token: ${{ secrets.GITHUB_TOKEN }}
GithubPages:
name: "Github Pages"
runs-on: ubuntu-22.04
needs: [ Build ]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Setup Node"
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: "Cache Node.js modules"
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.OS }}-node18-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node18-
${{ runner.OS }}-
- name: "Install dependencies"
run: npm ci --no-progress
- name: "Build summary"
run: npm run generate:website -- --gTagId ${{ secrets.GOOGLE_TAG_ID }}
- name: "Create tmorin-plantuml-public.zip"
run: zip -r ../tmorin-plantuml-public.zip *
working-directory: public
- name: "Upload tmorin-plantuml-public.zip"
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
tmorin-plantuml-public.zip
- name: "Publish Github Pages"
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
NpmPublication:
name: "NPM Publication"
runs-on: ubuntu-22.04
needs: [ Build ]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Setup node"
uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
scope: '@tmorin'
- name: "Install system dependencies"
run: sudo apt install graphviz zip
- name: "Cache Node.js modules"
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.OS }}-node18-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node18-
${{ runner.OS }}-
- name: "Install dependencies"
run: npm ci --no-progress
- name: "Publish package"
run: npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}