diff --git a/.github/workflows/nuxtjs.yml b/.github/workflows/nuxtjs.yml index 1dd2c94..a3e81e4 100644 --- a/.github/workflows/nuxtjs.yml +++ b/.github/workflows/nuxtjs.yml @@ -36,6 +36,7 @@ jobs: with: node-version: "20" cache: yarn + - name: Restore cache uses: actions/cache@v3 with: @@ -46,12 +47,14 @@ jobs: key: ${{ runner.os }}-nuxt-build-${{ hashFiles('dist') }} restore-keys: | ${{ runner.os }}-nuxt-build- + - name: Install dependencies run: yarn install - name: Generate Static Site run: yarn run generate env: NITRO_PRESET: github_pages + - name: Upload artifact uses: actions/upload-pages-artifact@v2 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f1a980f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,60 @@ +name: Create Artifact + +on: + # Runs on pushes targeting the default branch + push: + tags: ["v*"] + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "20" + cache: yarn + + - name: Restore cache + uses: actions/cache@v3 + with: + path: | + dist + .nuxt + .output + key: ${{ runner.os }}-nuxt-build-${{ hashFiles('dist') }} + restore-keys: | + ${{ runner.os }}-nuxt-build- + + - name: Install dependencies + run: yarn install + - name: Generate Static Site + run: yarn run generate + env: + NUXT_APP_BASE_URL: "/" + + - name: Create Archive + run: | + pushd .output/public + zip -r ../../release.zip . + popd + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + files: release.zip \ No newline at end of file diff --git a/nuxt.config.ts b/nuxt.config.ts index 1fb6beb..f5053bc 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,7 +1,9 @@ // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ app: { - baseURL: process.env.NODE_ENV === 'production' ? '/cyoa-editor/' : '/', + baseURL: + process.env.NUXT_APP_BASE_URL ?? + (process.env.NODE_ENV === 'production' ? '/cyoa-editor/' : '/'), buildAssetsDir: 'assets', head: { title: 'Interactive CYOA',