@@ -50,14 +50,93 @@ jobs:
50
50
cache-from : type=gha
51
51
cache-to : type=gha,mode=max
52
52
53
- release :
53
+ create-release :
54
+ name : create-release
54
55
runs-on : self-hosted
56
+ outputs :
57
+ upload_url : ${{ steps.release.outputs.upload_url }}
55
58
steps :
56
- - name : Checkout
57
- uses : actions/checkout@v3
58
- - name : Create release
59
+ - name : Create GitHub release
60
+ id : release
59
61
uses : softprops/action-gh-release@v1
60
62
if : startsWith(github.ref, 'refs/tags/')
61
63
with :
62
64
draft : true
63
65
generate_release_notes : true
66
+
67
+ build-binaries :
68
+ needs : [ "create-release" ]
69
+ runs-on :
70
+ - self-hosted
71
+ - ${{ matrix.os }}
72
+ strategy :
73
+ fail-fast : false
74
+ matrix :
75
+ build : [ linux, linux-arm, linux-arm64, freebsd ]
76
+ include :
77
+ - build : linux
78
+ os : Linux
79
+ target : x86_64-unknown-linux-gnu
80
+ - build : linux-arm
81
+ os : Linux
82
+ target : armv7-unknown-linux-gnueabihf
83
+ - build : linux-arm64
84
+ os : Linux
85
+ target : aarch64-unknown-linux-gnu
86
+ - build : freebsd
87
+ os : Linux
88
+ target : x86_64-unknown-freebsd
89
+ steps :
90
+ # Store the version, stripping any v-prefix
91
+ - name : Write release version
92
+ run : |
93
+ VERSION=${GITHUB_REF_NAME#v}
94
+ echo Version: $VERSION
95
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
96
+
97
+ - name : Checkout
98
+ uses : actions/checkout@v3
99
+ with :
100
+ submodules : recursive
101
+
102
+ - name : Install Rust stable
103
+ uses : actions-rs/toolchain@v1
104
+ with :
105
+ toolchain : stable
106
+ target : ${{ matrix.target }}
107
+ override : true
108
+
109
+ - name : Set up Docker BuildX
110
+ uses : docker/setup-buildx-action@v3
111
+ with :
112
+ config-inline : |
113
+ [registry."docker.io"]
114
+ mirrors = ["dockerhub-proxy.teonite.net"]
115
+
116
+ - name : Build release binary
117
+ uses : actions-rs/cargo@v1
118
+ with :
119
+ use-cross : true
120
+ command : build
121
+ args : --locked --release --target ${{ matrix.target }}
122
+
123
+ - name : Rename binary
124
+ run : mv target/${{ matrix.target }}/release/defguard-proxy defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}
125
+
126
+ - name : Tar
127
+
128
+ with :
129
+ command : c
130
+ files : |
131
+ defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}
132
+ outPath : defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
133
+
134
+ - name : Upload release archive
135
+
136
+ env :
137
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
138
+ with :
139
+ upload_url : ${{ needs.create-release.outputs.upload_url }}
140
+ asset_path : defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
141
+ asset_name : defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
142
+ asset_content_type : application/octet-stream
0 commit comments