forked from vikunja/frontend
97 lines
2.8 KiB
YAML
97 lines
2.8 KiB
YAML
# How the file was made: template used: GitHub's suggested "deploy Nuxt app to GitHub pages"
|
|
# Since it's a Vite project, better refer to https://vitejs.dev/guide/static-deploy.html#github-pages
|
|
name: Deploy and release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- webxdc*
|
|
# branches: ["webxdc-prototype"]
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
permissions:
|
|
# Need `contents: write` to make a release.
|
|
contents: write
|
|
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:
|
|
release-webxdc:
|
|
# Only make a release on tags
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# TODO refactor: steps are duplicated for both jobs. I think
|
|
# YAML can help here.
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
# https://pnpm.io/continuous-integration
|
|
- name: Set up pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 7
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "16"
|
|
cache: "pnpm"
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Build
|
|
run: pnpm run build-webxdc
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
# prerelease: ${{ contains(github.event.ref, '-beta') }}
|
|
prerelease: true
|
|
fail_on_unmatched_files: true
|
|
files: dist/*.xdc
|
|
|
|
# Deploy to GitHub Pages.
|
|
deploy-gh-pages:
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
# https://pnpm.io/continuous-integration
|
|
- name: Set up pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 7
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "16"
|
|
cache: "pnpm"
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Setup Pages
|
|
uses: actions/configure-pages@v3
|
|
- name: Build
|
|
env:
|
|
REPO_OWNER_AND_NAME: ${{ github.repository }}
|
|
#VIKUNJA_FRONTEND_BASE: /${{ github.repository }}/
|
|
# Set VIKUNJA_FRONTEND_BASE to the repo name
|
|
run: VIKUNJA_FRONTEND_BASE=$(echo "$REPO_OWNER_AND_NAME" | cut -d / -f 2) pnpm run build
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v1
|
|
with:
|
|
path: ./dist
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v1
|