feat: create Gitea Actions CI/CD workflow
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
51
.gitea/workflows/deploy.yml
Normal file
51
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.22'
|
||||
|
||||
- name: Go Modules Cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Lint & Test
|
||||
run: |
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2
|
||||
export PATH=$(go env GOPATH)/bin:$PATH
|
||||
golangci-lint run ./...
|
||||
go test -v -race ./...
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Docker Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and Push Docker Image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
latest
|
||||
${{ github.sha }}
|
||||
@@ -66,15 +66,15 @@
|
||||
- [x] verify docker-compose.yml syntax with `docker-compose config`
|
||||
|
||||
### Task 3: Create Gitea Actions CI/CD Workflow
|
||||
- [ ] create `.gitea/workflows/deploy.yml` file
|
||||
- [ ] add checkout step (actions/checkout@v3)
|
||||
- [ ] add setup Go step (actions/setup-go@v4, go-version: '1.22')
|
||||
- [ ] add Go modules cache step (actions/cache@v3)
|
||||
- [ ] add lint & test step (golangci-lint, go test -v -race ./...)
|
||||
- [ ] add Docker Buildx setup step (docker/setup-buildx-action@v2)
|
||||
- [ ] add Docker login step (docker/login-action@v2)
|
||||
- [ ] add Docker build & push step (docker/build-push-action@v4, tags: latest and {{.CommitID}})
|
||||
- [ ] verify Gitea Actions workflow YAML syntax
|
||||
- [x] create `.gitea/workflows/deploy.yml` file
|
||||
- [x] add checkout step (actions/checkout@v3)
|
||||
- [x] add setup Go step (actions/setup-go@v4, go-version: '1.22')
|
||||
- [x] add Go modules cache step (actions/cache@v3)
|
||||
- [x] add lint & test step (golangci-lint, go test -v -race ./...)
|
||||
- [x] add Docker Buildx setup step (docker/setup-buildx-action@v2)
|
||||
- [x] add Docker login step (docker/login-action@v2)
|
||||
- [x] add Docker build & push step (docker/build-push-action@v4, tags: latest and {{.CommitID}})
|
||||
- [x] verify Gitea Actions workflow YAML syntax
|
||||
|
||||
### Task 4: Verify acceptance criteria
|
||||
- [ ] verify Dockerfile matches multi-stage specification
|
||||
|
||||
Reference in New Issue
Block a user