Generate files #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CICD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
- name: Lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.54 | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
- run: go mod download | |
- run: go install github.com/a-h/templ/cmd/templ@latest | |
- run: templ generate -path ./components | |
- name: Test | |
run: go test -race ./... | |
tag: | |
name: Tag | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get Version | |
run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV | |
- name: Create Tag | |
uses: negz/create-tag@v1 | |
with: | |
version: ${{ env.VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
needs: | |
- tag | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
- name: Get Version | |
run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV | |
- run: go mod download | |
- run: go install github.com/a-h/templ/cmd/templ@latest | |
- name: Generate Templ Files | |
run: templ generate -path ./components | |
- name: Install Tailwindcss CLI | |
run: | | |
curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 | |
chmod +x tailwindcss-linux-x64 | |
mv tailwindcss-linux-x64 tailwindcss | |
- name: Generate CSS | |
run: tailwindcss -i ./styles/input.css -o ./assets/css/output@${{ env.VERSION }}.css --minify | |
- name: Replace token secret | |
run: sed -i 's/\${secrets.DB_TOKEN}/'"$DB_TOKEN"'/' app.yaml | |
env: | |
DB_TOKEN: ${{ secrets.DB_TOKEN }} | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
workload_identity_provider: 'projects/811165903449/locations/global/workloadIdentityPools/gh-pool/providers/gh-provider' | |
service_account: 'my-service-account@my-project.iam.gserviceaccount.com' | |
- id: 'deploy' | |
uses: 'google-github-actions/deploy-appengine@v1' | |
with: | |
version: ${{ env.VERSION }} |