From a6676c0017c3ec5843ca8198fcba1850b19f83e1 Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L. de Mello" Date: Thu, 23 May 2024 15:04:09 -0300 Subject: [PATCH] feat(ci): linting and previews --- .github/workflows/check.yml | 30 +++++++++++++++++++++++++ .github/workflows/deploy-preview.yml | 33 ++++++++++++++++++++++++++++ .github/workflows/deploy.yml | 8 ++++++- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/check.yml create mode 100644 .github/workflows/deploy-preview.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..6f59e75 --- /dev/null +++ b/.github/workflows/check.yml @@ -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 diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml new file mode 100644 index 0000000..923146a --- /dev/null +++ b/.github/workflows/deploy-preview.yml @@ -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 }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f820080..872d4ed 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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