10
10
required : true
11
11
default : ' test'
12
12
jobs :
13
- binary :
14
- name : Build Golang project
15
- runs-on : ubuntu-latest
16
- steps :
17
- - name : Set up Go 1.x
18
- uses : actions/setup-go@v2
19
- with :
20
- go-version : 1.18
21
-
22
- - run : |
23
- # https://github.com/actions/setup-go/issues/107
24
- cp -f `which go` /usr/bin/go
25
-
26
- - run : go version
27
-
28
- - name : Check out code into the Go module directory
29
- uses : actions/checkout@v2
30
-
31
- - name : Build
32
- run : make build
33
-
34
- - name : Archive artifacts for frpc
35
- uses : actions/upload-artifact@v1
36
- with :
37
- name : frpc
38
- path : bin/frpc
39
-
40
- - name : Archive artifacts for frps
41
- uses : actions/upload-artifact@v1
42
- with :
43
- name : frps
44
- path : bin/frps
45
-
46
13
image :
47
14
name : Build Image from Dockerfile and binaries
48
15
runs-on : ubuntu-latest
49
- needs : binary
50
16
steps :
51
17
# environment
52
18
- name : Checkout
60
26
- name : Set up Docker Buildx
61
27
uses : docker/setup-buildx-action@v1
62
28
63
- # download binaries of frpc and frps
64
- - name : Download binary of frpc
65
- uses : actions/download-artifact@v2
66
- with :
67
- name : frpc
68
- path : bin/frpc
69
-
70
- - name : Download binary of frps
71
- uses : actions/download-artifact@v2
72
- with :
73
- name : frps
74
- path : bin/frps
75
-
76
29
# get image tag name
77
30
- name : Get Image Tag Name
78
31
run : |
81
34
else
82
35
echo "TAG_NAME=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
83
36
fi
37
+ - name : Login to DockerHub
38
+ uses : docker/login-action@v1
39
+ with :
40
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
41
+ password : ${{ secrets.DOCKERHUB_PASSWORD }}
42
+
43
+ - name : Login to the GPR
44
+ uses : docker/login-action@v1
45
+ with :
46
+ registry : ghcr.io
47
+ username : ${{ github.repository_owner }}
48
+ password : ${{ secrets.GPR_TOKEN }}
84
49
85
50
# prepare image tags
86
51
- name : Prepare Image Tags
@@ -92,26 +57,24 @@ jobs:
92
57
echo "TAG_FRPC_GPR=ghcr.io/fatedier/frpc:${{ env.TAG_NAME }}" >> $GITHUB_ENV
93
58
echo "TAG_FRPS_GPR=ghcr.io/fatedier/frps:${{ env.TAG_NAME }}" >> $GITHUB_ENV
94
59
95
- # build images
96
- - name : Build Images
97
- run : |
98
- # for Docker hub
99
- docker build --file ${{ env.DOCKERFILE_FRPC_PATH }} --tag ${{ env.TAG_FRPC }} .
100
- docker build --file ${{ env.DOCKERFILE_FRPS_PATH }} --tag ${{ env.TAG_FRPS }} .
101
- # for GPR
102
- docker build --file ${{ env.DOCKERFILE_FRPC_PATH }} --tag ${{ env.TAG_FRPC_GPR }} .
103
- docker build --file ${{ env.DOCKERFILE_FRPS_PATH }} --tag ${{ env.TAG_FRPS_GPR }} .
104
-
105
- # push to dockerhub
106
- - name : Publish to Dockerhub
107
- run : |
108
- echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
109
- docker push ${{ env.TAG_FRPC }}
110
- docker push ${{ env.TAG_FRPS }}
111
-
112
- # push to gpr
113
- - name : Publish to GPR
114
- run : |
115
- echo ${{ secrets.GPR_TOKEN }} | docker login ghcr.io --username ${{ github.repository_owner }} --password-stdin
116
- docker push ${{ env.TAG_FRPC_GPR }}
117
- docker push ${{ env.TAG_FRPS_GPR }}
60
+ - name : Build and push frpc
61
+ uses : docker/build-push-action@v2
62
+ with :
63
+ context : .
64
+ file : ./dockerfiles/Dockerfile-for-frpc
65
+ platforms : linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
66
+ push : true
67
+ tags : |
68
+ ${{ env.TAG_FRPC }}
69
+ ${{ env.TAG_FRPC_GPR }}
70
+
71
+ - name : Build and push frps
72
+ uses : docker/build-push-action@v2
73
+ with :
74
+ context : .
75
+ file : ./dockerfiles/Dockerfile-for-frps
76
+ platforms : linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
77
+ push : true
78
+ tags : |
79
+ ${{ env.TAG_FRPS }}
80
+ ${{ env.TAG_FRPS_GPR }}
0 commit comments