Skip to content

publish-prerelease

publish-prerelease #84

name: publish-prerelease
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+-prerelease.[0-9]+
workflow_dispatch:
tags:
- v[0-9]+.[0-9]+.[0-9]+-prerelease.[0-9]+
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
build:
runs-on: ubuntu-latest
env:
GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }}
steps:
- uses: actions/checkout@v4.1.1
with:
token: ${{ secrets.BOT_ACCOUNT_GITHUB_TOKEN }}
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v4.0.1
with:
node-version: 20
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4.0.0
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Cache build
uses: actions/cache@v4.0.0
id: cache-build
with:
path: |
semcore/*/lib
tools/*/lib
semcore/icon/**/*.js
semcore/icon/**/*.mjs
semcore/icon/**/*.d.ts
semcore/illustration/**/*.js
semcore/illustration/**/*.mjs
semcore/illustration/**/*.d.ts
semcore/illustration/svg/*.svg
key: build-${{ hashFiles('**/pnpm-lock.yaml', '**/CHANGELOG.md') }}-5
- name: Install dependencies
run: |
pnpm install --frozen-lockfile
- name: Build
if: steps.cache-build.outputs.cache-hit != 'true'
run: pnpm build
static-lint:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Install Node.js
uses: actions/setup-node@v4.0.1
with:
node-version: 20
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4.0.0
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Restore cached build
uses: actions/cache@v4.0.0
id: cache-build
with:
path: |
semcore/*/lib
tools/*/lib
semcore/icon/**/*.js
semcore/icon/**/*.mjs
semcore/icon/**/*.d.ts
semcore/illustration/**/*.js
semcore/illustration/**/*.mjs
semcore/illustration/**/*.d.ts
semcore/illustration/svg/*.svg
key: build-${{ hashFiles('**/pnpm-lock.yaml', '**/CHANGELOG.md') }}-5
- name: Install dependencies
run: |
pnpm install --frozen-lockfile
- name: Lint
run: pnpm --filter intergalactic-migrate run build && pnpm lint
unit-tests:
runs-on: ubuntu-latest
needs: build
env:
GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }}
steps:
- uses: actions/checkout@v4.1.1
with:
token: ${{ secrets.BOT_ACCOUNT_GITHUB_TOKEN }}
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v4.0.1
with:
node-version: 20
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4.0.0
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Restore cached build
uses: actions/cache@v4.0.0
with:
path: |
semcore/*/lib
tools/*/lib
semcore/icon/**/*.js
semcore/icon/**/*.mjs
semcore/icon/**/*.d.ts
semcore/illustration/**/*.js
semcore/illustration/**/*.mjs
semcore/illustration/**/*.d.ts
semcore/illustration/svg/*.svg
key: build-${{ hashFiles('**/pnpm-lock.yaml', '**/CHANGELOG.md') }}-5
- name: Install restored dependencies
run: |
pnpm install --frozen-lockfile
- name: Test setup
id: test-setup
run: pnpm test:setup
- name: Test
id: test
run: |
pnpm upload-static
pnpm test:docker run -- --allowOnly=false
continue-on-error: true
- name: Save test results as artifacts
if: steps.test.outcome != 'success'
uses: actions/upload-artifact@v3
with:
name: unit-testing-failure-output
path: semcore/*/__tests__/__image_snapshots__/__diff_output__/
retention-days: 3
- name: Fail if test step actually failed
if: steps.test.outcome != 'success'
run: exit 1
publish-prerelease:
runs-on: ubuntu-latest
needs: [static-lint, unit-tests, browser-tests]
env:
GITHUB_SECRET: ${{ secrets.BOT_ACCOUNT_GITHUB_TOKEN }}
GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }}
steps:
- uses: actions/checkout@v4.1.1
with:
token: ${{ secrets.BOT_ACCOUNT_GITHUB_TOKEN }}
fetch-depth: 0
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false
- uses: actions/setup-node@v4.0.1
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4.0.0
name: Restore pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Restore cached build
uses: actions/cache@v4.0.0
with:
path: |
semcore/*/lib
tools/*/lib
semcore/icon/**/*.js
semcore/icon/**/*.mjs
semcore/icon/**/*.d.ts
semcore/illustration/**/*.js
semcore/illustration/**/*.mjs
semcore/illustration/**/*.d.ts
semcore/illustration/svg/*.svg
key: build-${{ hashFiles('**/pnpm-lock.yaml', '**/CHANGELOG.md') }}-5
- name: Install restored dependencies
run: |
pnpm install
- name: Github GPG Auth
uses: crazy-max/ghaction-import-gpg@v5.3.0
with:
gpg_private_key: ${{ secrets.BOT_ACCOUNT_GPG_PRIVATE_KEY }}
git_user_signingkey: true
git_commit_gpgsign: true
git_committer_name: semrush-ci-whale
git_committer_email: semrush-ci-whale@users.noreply.github.com
- name: NPM setup
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ".npmrc"
echo "strict-peer-dependencies=false" >> ".npmrc"
- name: NPM auth check
run: pnpm whoami
- name: Deliver prerelease (old release system)
run: |
pnpm --filter intergalactic-migrate run build
pnpm publish-prerelease
browser-tests:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4.1.1
- uses: pnpm/action-setup@v2.2.4
with:
version: 8
run_install: false
- name: Browser testing
id: browser-testing
run: |
docker run --rm --network host -v $(pwd):/work -v /work/node_modules -v /work/.pnpm-store -v /work/.cache -w /work/ mcr.microsoft.com/playwright:v1.35.0-jammy bash -c "npm install --global pnpm@8.11.0 && pnpm install --ignore-scripts && pnpm build:icons && pnpm build:illustration && npx playwright install && CI=true pnpm playwright test --config playwright.browser.config.ts"
continue-on-error: true
- name: Save test results as artifacts
if: steps.browser-testing.outcome != 'success'
uses: actions/upload-artifact@v3
with:
name: browser-testing-failure-output
path: test-results
retention-days: 3
- name: Fail if test step actually failed
if: steps.browser-testing.outcome != 'success'
run: exit 1