chore: refactor build process and repository cleanup

- Introduce Go setup and caching in Docker GitHub Actions workflow
- Add `release` directory to `.gitignore`
- Remove `main.go` file from the repository

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2024-02-20 09:51:29 +08:00
parent 0d1a3ae368
commit 9d1d40c08a
No known key found for this signature in database
3 changed files with 28 additions and 14 deletions

View File

@ -24,6 +24,33 @@ jobs:
with: with:
fetch-depth: 0 # all history for all branches and tags fetch-depth: 0 # all history for all branches and tags
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- uses: https://gitea.com/actions/go-hashfiles@v0.0.1
id: hash-go
with:
patterns: |
go.mod
go.sum
- name: cache go
id: cache-go
uses: https://github.com/actions/cache@v3
with:
path: |
/go_path
/go_cache
key: go_path-${{ steps.hash-go.outputs.hash }
- name: Build binary
env:
TAGS: ""
run: |
make docker-build-linux-amd64
make docker-build-linux-arm64
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2

2
.gitignore vendored
View File

@ -20,4 +20,4 @@
# Go workspace file # Go workspace file
go.work go.work
release

13
main.go
View File

@ -1,13 +0,0 @@
package main
import (
"gitea.com/action-examples/go/router"
)
func main() {
r := router.New()
// listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
if err := r.Run(); err != nil {
panic(err)
}
}