@@ -12,12 +12,12 @@ jobs:
1212 runs-on : ubuntu-latest
1313 steps :
1414 - name : Set up Go 1.x
15- uses : actions/setup-go@v2
15+ uses : actions/setup-go@v5
1616 with :
1717 go-version : ' 1.20'
1818
1919 - name : Check out code into the Go module directory
20- uses : actions/checkout@v2
20+ uses : actions/checkout@v4
2121
2222 - name : Get dependencies
2323 run : go get -v -t -d ./...
@@ -39,19 +39,47 @@ jobs:
3939 CGO_ENABLED=0 GOARCH=loong64 GOOS=linux go build -ldflags="-s -w" -o auth-thu.linux.loong64 ./cli/main.go
4040
4141 - name : Create Release
42- id : create_release
43- uses : actions/create-release@v1
44- env :
45- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
46- with :
47- tag_name : ${{ github.ref }}
48- release_name : ${{ github.ref }}
49- draft : false
50- prerelease : false
51- - name : Upload Artifacts
5242 env :
5343 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5444 run : |
5545 tag_name="${GITHUB_REF##*/}"
56- hub release edit $(find . -type f -executable -name "auth-thu.*" -printf "-a %p ") -m "" "$tag_name"
46+ gh release create "$tag_name" -t "$tag_name" auth-thu.*
47+
48+ build-image :
49+ name : Build Image
50+ runs-on : ubuntu-latest
51+ needs : build
52+ env :
53+ REGISTRY : ghcr.io
54+ IMAGE_NAME : ${{ github.repository }}
55+
56+ steps :
57+ - name : Check out code into the Go module directory
58+ uses : actions/checkout@v4
59+
60+ - name : Set up QEMU
61+ uses : docker/setup-qemu-action@v3
5762
63+ - name : Set up Docker Buildx
64+ uses : docker/setup-buildx-action@v3
65+
66+ - name : Log in to the Container Registry
67+ uses : docker/login-action@v3
68+ with :
69+ registry : ${{ env.REGISTRY }}
70+ username : ${{ github.actor }}
71+ password : ${{ secrets.GITHUB_TOKEN }}
72+
73+ - name : Extract metadata
74+ id : metadata
75+ uses : docker/metadata-action@v5
76+ with :
77+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
78+
79+ - name : Build and push the Docker image
80+ uses : docker/build-push-action@v5
81+ with :
82+ push : true
83+ context : .
84+ tags : ${{ steps.metadata.outputs.tags }}
85+ labels : ${{ steps.metadata.outputs.labels }}
0 commit comments