|
| 1 | +name: build-scratch-blocks |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [master, develop, beta, hotfix/*] |
| 5 | +jobs: |
| 6 | + setup: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + env: |
| 9 | + JVM_OPTS: -Xmx3200m |
| 10 | + DETECT_CHROMEDRIVER_VERSION: true |
| 11 | + PROJECT_PATH: ./scratch-blocks |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v3 |
| 14 | + - name: Install Chrome Dependencies |
| 15 | + run: | |
| 16 | + sudo apt-get update |
| 17 | + sudo apt-get install -y libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2 |
| 18 | + - name: Check Python version |
| 19 | + run: python --version |
| 20 | + - name: Setup Java |
| 21 | + uses: actions/setup-java@v3 |
| 22 | + with: |
| 23 | + distribution: 'temurin' |
| 24 | + java-version: 17 |
| 25 | + - name: Setup Node |
| 26 | + uses: actions/setup-node@v3 |
| 27 | + with: |
| 28 | + node-version-file: '.nvmrc' |
| 29 | + - uses: browser-actions/setup-chrome@v1 |
| 30 | + with: |
| 31 | + chrome-version: stable |
| 32 | + id: setup-chrome |
| 33 | + - run: | |
| 34 | + echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }} |
| 35 | + ${{ steps.setup-chrome.outputs.chrome-path }} --version |
| 36 | + - name: Install Node Dependencies |
| 37 | + run: npm ci |
| 38 | + - name: Lint |
| 39 | + run: npm run test:lint |
| 40 | + - name: Run Tests |
| 41 | + run: npm run test:messages |
| 42 | + - name: Run Unit Tests |
| 43 | + run: DISPLAY=:99 npm run test:unit |
| 44 | + - name: Remove Closure App |
| 45 | + run: rm -rf gh-pages/closure-library/scripts/ci/CloseAdobeDialog.exe |
| 46 | + - name: Deploy playground to GitHub Pages |
| 47 | + uses: peaceiris/actions-gh-pages@v3 |
| 48 | + with: |
| 49 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + publish_dir: ./gh-pages |
| 51 | + full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}" |
| 52 | + enable_jekyll: true |
| 53 | + - name: Deploy to npm |
| 54 | + if: (github.ref == 'refs/heads/master') || (github.ref == 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/hotfix') || startsWith(github.ref, 'refs/heads/release') || startsWith(github.ref, 'refs/heads/beta') |
| 55 | + run: | |
| 56 | + export RELEASE_VERSION="0.2.0-prerelease.$(date +'%Y%m%d%H%M%S')" |
| 57 | + if [[ "${{contains(github.ref, 'hotfix')}} ]]; then |
| 58 | + export NPM_TAG=hotfix |
| 59 | + elif [[ "${{contains(github.ref, 'beta')}} ]]; then |
| 60 | + export NPM_TAG=beta |
| 61 | + else |
| 62 | + export NPM_TAG=latest |
| 63 | + fi |
| 64 | + echo "Deploying version $RELEASE_VERSION to $NPM_TAG" |
| 65 | + npm --no-git-tag-version version $RELEASE_VERSION |
| 66 | + npm set //registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}} |
| 67 | + npm publish --tag $NPM_TAG |
| 68 | + if npm info | grep -q $RELEASE_VERSION; then |
| 69 | + git tag $RELEASE_VERSION |
| 70 | + git push \ |
| 71 | + https://${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git \ |
| 72 | + $RELEASE_VERSION |
| 73 | + fi |
0 commit comments