Skip to content

Publish to monorepo-test-deployment #17

Publish to monorepo-test-deployment

Publish to monorepo-test-deployment #17

# .github/workflows/publish.yml
name: Publish to monorepo-test-deployment
on:
workflow_run:
workflows: ["CI"] # runs after CI workflow
branches: ["monorepo"]
types:
- completed
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
name: Build and Push
steps:
- if: github.event.workflow_run.conclusion != 'success'
run: |
echo "CI step didn't pass, exiting"
exit 1
- uses: actions/checkout@v3
with:
ref: monorepo
- uses: actions/setup-node@v3
with:
node-version: 18.x
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 9.1
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- uses: actions/cache@v4
name: Setup Next.js cache
with:
path: |
${{ github.workspace }}/src/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.json') }}-
- name: Install all dependencies
working-directory: ./src
run: pnpm install --frozen-lockfile
- name: Build
working-directory: ./src
run: pnpm build
- name: Build cli
working-directory: ./src
run: pnpm build:cli
- name: Delete files not needed in deployment
working-directory: ./src
run: rm -rf __tests__ app pages components coverage data helpers hooks moonraker env recoil server utils zods test-setup.ts vitest.config.mts tsconfig.vitest.json copy-files-from-to.json components.json postcss.config.js prettier.config.mjs tailwind.config.ts
- name: Rename src/ to app/
working-directory: ./
run: mv src app
- name: Publish to monorepo-test-deployment
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: .
git-config-name: Mikkel Schmidt
git-config-email: [email protected]
branch: monorepo-test-deployment # The branch name where you want to push the assets