Skip to content

Commit 304478d

Browse files
committed
feat: add actions
1 parent 82491c0 commit 304478d

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: publish-to-vercel
2+
on:
3+
workflow_call:
4+
inputs:
5+
is-preview:
6+
description: 'Is this a preview deployment?'
7+
default: true
8+
required: false
9+
type: boolean
10+
env:
11+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
12+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version-file: '.nvmrc'
21+
cache: 'pnpm'
22+
- uses: pnpm/[email protected]
23+
- run: pnpm install --frozen-lockfile
24+
- name: Pull Vercel Environment Information
25+
run: vercel pull --yes --environment=${{ inputs.is-preview && 'preview' || 'production'}} --token=${{ secrets.VERCEL_TOKEN }}
26+
- name: Build Project Artifacts
27+
run: vercel build --token=${{ secrets.VERCEL_TOKEN }} ${{ !inputs.is-preview && '--prod'}}
28+
- name: Deploy Project Artifacts to Vercel
29+
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} ${{ !inputs.is-preview && '--prod'}}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: issue-publish
2+
on:
3+
issues:
4+
types:
5+
- labeled
6+
jobs:
7+
post_created:
8+
if: |
9+
!github.event.issue.pull_request &&
10+
contains(github.event.issue.labels.*.name, 'status/not-published')
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: ./.github/workflows/deploy-to-vercel.yml
14+
with:
15+
is-preview: true
16+
post_published:
17+
if: |
18+
!github.event.issue.pull_request &&
19+
(
20+
contains(github.event.issue.labels.*.name, 'status/published') ||
21+
contains(github.event.issue.labels.*.name, 'status/archived') ||
22+
contains(github.event.issue.labels.*.name, 'meta/featured')
23+
)
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: ./.github/workflows/deploy-to-vercel.yml
27+
with:
28+
is-preview: false

0 commit comments

Comments
 (0)