Publish to v2.1.x-deployment #77
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .github/workflows/publish.yml | |
name: Publish to v2.1.x-deployment | |
on: | |
workflow_run: | |
workflows: ["CI"] # runs after CI workflow | |
branches: ["v2.1.x"] | |
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: v2.1.x | |
- 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('**/package-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('**/package-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: Push | |
uses: s0/git-publish-subdir-action@develop | |
env: | |
REPO: self | |
BRANCH: v2.1.x-deployment # The branch name where you want to push the assets | |
FOLDER: "src" # The directory where your assets are generated | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token | |
MESSAGE: "Build: ({sha}) {msg}" # The commit message |