summaryrefslogtreecommitdiff
path: root/.github/workflows/production.yaml
blob: 67efd4108237d3c51019b6e343f0318f0f61548d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: production
env:
  VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
  VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
  push:
    branches:
      - master

jobs:
  deploy-production:
    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: Setup Go
        uses: actions/setup-go@v4.0.0
        with:
          go-version: '^1.21'

      - 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