Skip to content

Commit

Permalink
feat: make ci run every commit in order to run multiple hypothesis, b…
Browse files Browse the repository at this point in the history
…ut only deploys on master and if the build succeed
  • Loading branch information
tolstenko committed Dec 13, 2023
1 parent 244d39c commit ac0d3c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 39 deletions.
50 changes: 12 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
name: ci

# runs on every push to any branch
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
workflow_dispatch:

jobs:
build:
Expand All @@ -20,14 +15,14 @@ jobs:
# - name: Log in to registry
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
# cache 'upstream' and 'demo/node_modules' folders
- uses: actions/cache@v2
with:
path: |
upstream
demo/node_modules
build/emsdk_cache
key: ${{ runner.os }}-${{ hashFiles('build/emsdk_cache/sanity.txt') }}-${{ hashFiles('demo/package-lock.json') }}
restore-keys: ${{ runner.os }}-upstream-
# - uses: actions/cache@v2
# with:
# path: |
# upstream
# demo/node_modules
# build/emsdk_cache
# key: ${{ runner.os }}-${{ hashFiles('build/emsdk_cache/sanity.txt') }}-${{ hashFiles('demo/package-lock.json') }}
# restore-keys: ${{ runner.os }}-upstream-

- name: Build
run: |
Expand All @@ -38,12 +33,10 @@ jobs:
with:
node-version: 16

- name: Build demo
run: |
./build-demo.sh
# deploy build/demo to gh-pages
- uses: peaceiris/actions-gh-pages@v3
# runs only on master and if the file build/demo/index.html exists
if: github.ref == 'refs/heads/master' && fileExists('build/demo/index.html')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/demo
Expand All @@ -57,23 +50,4 @@ jobs:
with:
name: dist
path: ./build.zip
retention-days: 1


# release:
# needs: build
# name: Create Release
# runs-on: ubuntu-latest
# if: startsWith(github.ref, 'refs/tags/')
# steps:
# - uses: actions/checkout@v3
# - uses: actions/download-artifact@v3
# - uses: softprops/action-gh-release@v1
# with:
# files: dist/*.*
# - name: Setup npmrc
# run: |
# echo "@jprendes:registry=https://npm.pkg.github.com/" >> .npmrc
# echo "//npm.pkg.github.com/:_authToken=${{secrets.GITHUB_TOKEN}}" >> .npmrc
# - name: Publish
# run: npm publish
retention-days: 1
2 changes: 1 addition & 1 deletion build-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export $(cat .env | xargs)

SRC=$(dirname $0)

pushd $SRC/demo
pushd $SRC/demo-monaco
npm install
npm run build
popd
Expand Down

0 comments on commit ac0d3c7

Please sign in to comment.