-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (37 loc) · 1.36 KB
/
go.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Go
on:
push:
branches: [ "master","main" ]
pull_request:
branches: [ "master","main" ]
env:
CARGO_TERM_COLOR: always
REGISTRY_USER: arloor
IMAGE_REGISTRY: docker.io
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: build-and-push
run: |
go mod tidy
CGO_ENABLED=0 go build -ldflags '-w -s' -a -installsuffix cgo -o go_web_server go_web_server/cmd/go_web_server
podman build -f Dockerfile . -t docker.io/arloor/go_web_server:${{ github.sha }} -t docker.io/arloor/go_web_server:latest
podman login docker.io -u arloor -p ${{ env.REGISTRY_PASSWORD }}
podman push docker.io/arloor/go_web_server:${{ github.sha }}
podman push docker.io/arloor/go_web_server:latest
- name: gihub_release
env:
GH_TOKEN: ${{ github.token }}
run: |
if $(gh release delete v1.0.0 -y --cleanup-tag);
then echo "delete old release";
else echo "no old release";
fi
git config --local user.email "[email protected]"
git config --local user.name "arloor"
git tag -f v1.0.0 -m 'latest'
git push --force origin v1.0.0
gh release create v1.0.0 go_web_server --notes-from-tag --latest -t latest