mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 10:15:31 +00:00
85 lines
2.8 KiB
YAML
85 lines
2.8 KiB
YAML
name: CI
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
node-version: [20.x]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- name: Install Dependencies
|
|
run: yarn install --frozen-lockfile
|
|
- name: Build
|
|
run: |
|
|
yarn workspace ani-cursor build
|
|
yarn workspace webamp build
|
|
yarn workspace webamp build-library
|
|
- name: Lint
|
|
run: |
|
|
yarn lint
|
|
yarn workspace webamp type-check
|
|
- name: Run Unit Tests
|
|
run: |
|
|
touch packages/skin-database/config.js
|
|
yarn test
|
|
yarn workspace webamp test
|
|
- name: Run Integration Tests
|
|
run: yarn workspace webamp integration-tests
|
|
env:
|
|
CI: true
|
|
- name: Upload Screenshot Diffs
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: image_diffs
|
|
path: packages/webamp/js/__tests__/__image_snapshots__/__diff_output__/
|
|
- name: Generate New Screenshots
|
|
if: failure()
|
|
run: |
|
|
yarn workspace webamp integration-tests -u
|
|
- name: Upload New Screenshots
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: new_images
|
|
path: packages/webamp/js/__tests__/__image_snapshots__/
|
|
main-release:
|
|
name: Publish to NPM
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && github.repository == 'captbaritone/webamp'
|
|
needs: [build-and-test]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
registry-url: https://registry.npmjs.org/
|
|
- name: Install dependencies
|
|
run: yarn install --frozen-lockfile
|
|
- name: Build latest (master) version
|
|
if: github.ref == 'refs/heads/master'
|
|
run: |
|
|
yarn workspace webamp build-library
|
|
echo "Setting version to 0.0.0-next-${RELEASE_COMMIT_SHA::7}"
|
|
yarn workspace webamp version --new-version 0.0.0-next-${RELEASE_COMMIT_SHA::7} --no-git-tag-version
|
|
env:
|
|
RELEASE_COMMIT_SHA: ${{ github.sha }}
|
|
- name: Build release version
|
|
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
|
|
run: exit 1 # TODO: Script to update version number in webampLazy.tsx
|
|
- name: Publish to npm
|
|
working-directory: ./packages/webamp
|
|
if: github.ref == 'refs/heads/master' || github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
|
|
run: |
|
|
npm publish ${TAG}
|
|
env:
|
|
TAG: ${{ github.ref == 'refs/heads/master' && '--tag=next' || ''}}
|
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|