From e8a397927c571175aeee4541043d8b678ae5458d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Fr=C3=B6hlich?= Date: Sat, 16 Sep 2023 01:52:36 +0200 Subject: [PATCH] chore(deployment): add workflow file --- .github/workflows/studio.yml | 82 ++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/studio.yml diff --git a/.github/workflows/studio.yml b/.github/workflows/studio.yml new file mode 100644 index 00000000..c5243cf5 --- /dev/null +++ b/.github/workflows/studio.yml @@ -0,0 +1,82 @@ + +name: studio-nuxt-build +run-name: studio nuxt build + +on: + # Runs on pushes targeting the default branch + push: + branches: + - 'main' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Add write workflow permissions +permissions: + contents: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + # Build job + build-and-deploy: + runs-on: ${{ matrix.os }} + defaults: + run: + working-directory: . + + strategy: + matrix: + os: [ubuntu-latest] + node: [18] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Identify package manager + id: pkgman + run: | + cache=`[ -f "./pnpm-lock.yaml" ] && echo "pnpm" || ([ -f "./package-lock.json" ] && echo "npm" || ([ -f "./yarn.lock" ] && echo "yarn" || echo ""))` + package_manager=`[ ! -z "$cache" ] && echo "$cache" || echo "pnpm"` + echo "cache=$cache" >> $GITHUB_OUTPUT + echo "package_manager=$package_manager" >> $GITHUB_OUTPUT + + - uses: pnpm/action-setup@v2.2.4 + if: ${{ steps.pkgman.outputs.package_manager == 'pnpm' }} + name: Install pnpm + id: pnpm-install + with: + version: 7 + + - uses: actions/setup-node@v3 + with: + version: ${{ matrix.node }} + cache: ${{ steps.pkgman.outputs.cache }} + + - name: Install dependencies + run: ${{ steps.pkgman.outputs.package_manager }} install + + - name: Install @nuxthq/studio + run: ${{ steps.pkgman.outputs.package_manager }} add -D @nuxthq/studio + + - name: Create .nuxtrc + run: echo 'modules[]=@nuxthq/studio' > .nuxtrc + + - name: Generate + run: npx nuxi generate + env: + NUXT_PUBLIC_STUDIO_API_URL: https://api.nuxt.studio + NUXT_PUBLIC_STUDIO_TOKENS: 87e8466ce8e4aebf79e2eedee50e6c14a172530a0f209ab8831686cd38a9dd07 + + - name: Add .nojekyll file + run: touch .output/public/.nojekyll + + # Deployment job + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: ./.output/public