feat(ci): linting and previews

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-05-23 15:04:09 -03:00
parent 703ba09ed9
commit a6676c0017
3 changed files with 70 additions and 1 deletions

30
.github/workflows/check.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: Checks
on:
push:
branches:
- main
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
jobs:
lint:
name: Lint
if: ${{ github.repository == 'dot013/.www-new' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: '1.22.2'
- name: Check
uses: golangci/golangci-lint-action@v6
with:
version: v1.58

33
.github/workflows/deploy-preview.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: Deploy preview to vercel
on:
workflow_run:
workflows:
- Checks
types:
- completed
branches-ignore:
- main
jobs:
deploy:
name: Deploy preview
if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository == 'dot013/.www-new' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: '1.22.2'
- name: Build
run: |
go install github.com/a-h/templ/cmd/templ@latest
make build-vercel
- name: Deploy
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}

View File

@@ -1,12 +1,18 @@
name: Deploy to vercel
on:
push:
workflow_run:
workflows:
- Checks
types:
- completed
branches:
- main
jobs:
deploy:
name: Deploy
if: ${{ github.repository == 'dot013/.www-new' }}
runs-on: ubuntu-latest
steps:
- name: Checkout