Skip to content

Commit

Permalink
Release on tag pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ltouroumov committed Nov 12, 2024
1 parent bc9b915 commit 320c156
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/nuxtjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
with:
node-version: "20"
cache: yarn

- name: Restore cache
uses: actions/cache@v3
with:
Expand All @@ -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:
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down

0 comments on commit 320c156

Please sign in to comment.