Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Commit

Permalink
add preview workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukuro committed Jan 2, 2024
1 parent a3d1cca commit 7f07b81
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
push:
branches:
branches-ignore:
- master
pull_request:

Expand Down Expand Up @@ -36,14 +36,14 @@ jobs:
working-directory: ./testenv

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} --cwd ./testenv
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} --cwd ./testenv

- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} --cwd ./testenv
run: vercel build --token=${{ secrets.VERCEL_TOKEN }} --cwd ./testenv

- name: Deploy Project Artifacts to Vercel
if: ${{ github.ref == 'refs/heads/master' }}
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} --cwd ./testenv
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} --cwd ./testenv

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: GitHub Pages
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true

- name: Install Vercel CLI
run: npm install --global vercel@latest

- name: SetUp Env
run: hugo new site testenv

- name: Set theme
uses: actions/checkout@v3
with:
path: ./testenv/themes/hugo-theme-shell

- name: Build
run: hugo --minify -t hugo-theme-shell
working-directory: ./testenv

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} --cwd ./testenv

- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} --cwd ./testenv

- name: Deploy Project Artifacts to Vercel
if: ${{ github.ref == 'refs/heads/master' }}
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} --cwd ./testenv

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/master' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./testenv/public

0 comments on commit 7f07b81

Please sign in to comment.