Skip to content

Github Actions

Corey Peterson edited this page Oct 30, 2023 · 2 revisions

Below are copies of the two GitHub actions files that should be included in each widget repository: tests.yml and release-build.yml. Both workflow files should be placed in the .github/workflows directory of your widget.

test.yml

name: Run Tests
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18.13.0]
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
    - name: Run tests with Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm install -g yarn
    - run: yarn install
    - run: yarn test-ci
    - run: yarn build

release-build.yml

name: Widget Release Build
on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
     - 'v[0-9]+.[0-9]+.[0-9]+'
     - 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
     - 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
jobs:
  deploy:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18.13.0]

    steps:
    - name: Checkout code
      uses: actions/checkout@v4

    - name: Test and build with node ${{ matrix.node-version }}
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node-version }}

    - run: yarn install --frozen-lockfile
    - run: yarn build

    - name: Upload Release .wigt
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: build/_output/*
        tag: ${{ github.ref }}
        overwrite: true
        file_glob: true
Clone this wiki locally