81 lines
2.6 KiB
YAML
81 lines
2.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RELEASE: ${{ github.event.release.name }}
|
|
RELEASE_ZIP: kittycad_diff-viewer_${{ github.event.release.name }}.zip
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3.5.2
|
|
|
|
- uses: actions/setup-node@v3.6.0
|
|
with:
|
|
node-version: '16'
|
|
cache: 'yarn'
|
|
|
|
- run: yarn install
|
|
|
|
- name: Set release version to .json files and commit to main
|
|
if: github.event_name == 'release'
|
|
env:
|
|
BRANCH: main
|
|
run: |
|
|
git fetch origin
|
|
git checkout $BRANCH
|
|
echo "$(jq --arg v "${RELEASE#v}" '.version=$v' package.json --indent 4)" > package.json
|
|
echo "$(jq --arg v "${RELEASE#v}" '.version=$v' public/manifest.json --indent 4)" > public/manifest.json
|
|
git diff
|
|
git add .
|
|
git config user.name github-actions
|
|
git config user.email github-actions@github.com
|
|
git commit -m "Align versions with $RELEASE"
|
|
git push origin $BRANCH
|
|
|
|
- run: yarn build
|
|
|
|
- run: yarn test
|
|
|
|
- name: Run playwright e2e tests
|
|
env:
|
|
GITHUB_TOKEN: ${{secrets.GLOBAL_PAT}}
|
|
KITTYCAD_TOKEN: ${{secrets.KITTYCAD_TOKEN}}
|
|
run: |
|
|
yarn playwright install chromium --with-deps
|
|
yarn playwright test
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
path: build
|
|
|
|
- name: Create release zip
|
|
if: github.event_name == 'release'
|
|
run: |
|
|
zip -r $RELEASE_ZIP build/
|
|
|
|
- name: Upload zip to release
|
|
if: github.event_name == 'release'
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
file: $RELEASE_ZIP
|
|
|
|
- name: Upload zip to Chrome Web Store
|
|
if: github.event_name == 'release'
|
|
uses: mobilefirstllc/cws-publish@latest
|
|
with:
|
|
action: publish
|
|
client_id: ${{ secrets.CHROME_WEBSTORE_CLIENT_ID }}
|
|
client_secret: ${{ secrets.CHROME_WEBSTORE_CLIENT_SECRET }}
|
|
refresh_token: ${{ secrets.CHROME_WEBSTORE_REFRESH_TOKEN }}
|
|
extension_id: gccpihmphokfjpohkmkbimnhhnlpmegp
|
|
zip_file: $RELEASE_ZIP
|