11name : Make a new release
22on :
33 push :
4- branches :
5- - apt_repository
6- # tags:
7- # - v*.*.*
4+ tags :
5+ - v*.*.*
86
97concurrency :
108 group : ${{ github.workflow }}-${{ github.ref }}
119 cancel-in-progress : true
1210
1311jobs :
14- # build-docker-release:
15- # # Ignore tags with -, like v1.0.0-alpha
16- # # This job will build the docker container with the "latest" tag which
17- # # is a tag used in production, thus it should only be run for full releases.
18- # if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-')
19- # name: Build Release Docker image
20- # uses: ./.github/workflows/build-docker.yml
21- # with:
22- # tags: |
23- # type=raw,value=latest
24- # type=semver,pattern={{version}}
25- # type=semver,pattern={{major}}.{{minor}}
26- # type=sha
27-
28- # build-docker-prerelease:
29- # # Only build tags with -, like v1.0.0-alpha
30- # if: startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-')
31- # name: Build Pre-release Docker image
32- # uses: ./.github/workflows/build-docker.yml
33- # with:
34- # tags: |
35- # type=raw,value=pre-release
36- # type=semver,pattern={{version}}
37- # type=sha
38- # # Explicitly disable latest tag. It will be added otherwise.
39- # flavor: |
40- # latest=false
12+ build-docker-release :
13+ # Ignore tags with -, like v1.0.0-alpha
14+ # This job will build the docker container with the "latest" tag which
15+ # is a tag used in production, thus it should only be run for full releases.
16+ if : startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-')
17+ name : Build Release Docker image
18+ uses : ./.github/workflows/build-docker.yml
19+ with :
20+ tags : |
21+ type=raw,value=latest
22+ type=semver,pattern={{version}}
23+ type=semver,pattern={{major}}.{{minor}}
24+ type=sha
25+
26+ build-docker-prerelease :
27+ # Only build tags with -, like v1.0.0-alpha
28+ if : startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-')
29+ name : Build Pre-release Docker image
30+ uses : ./.github/workflows/build-docker.yml
31+ with :
32+ tags : |
33+ type=raw,value=pre-release
34+ type=semver,pattern={{version}}
35+ type=sha
36+ # Explicitly disable latest tag. It will be added otherwise.
37+ flavor : |
38+ latest=false
4139
4240 create-release :
4341 name : create-release
@@ -48,16 +46,16 @@ jobs:
4846 - name : Create GitHub release
4947 id : release
5048 uses : softprops/action-gh-release@v1
51- # if: startsWith(github.ref, 'refs/tags/')
49+ if : startsWith(github.ref, 'refs/tags/')
5250 with :
5351 draft : true
5452 generate_release_notes : true
5553
56- # create-sbom:
57- # needs: [create-release, build-docker-release]
58- # uses: ./.github/workflows/sbom.yml
59- # with:
60- # upload_url: ${{ needs.create-release.outputs.upload_url }}
54+ create-sbom :
55+ needs : [create-release, build-docker-release]
56+ uses : ./.github/workflows/sbom.yml
57+ with :
58+ upload_url : ${{ needs.create-release.outputs.upload_url }}
6159
6260 build-binaries :
6361 needs : [create-release]
@@ -68,32 +66,27 @@ jobs:
6866 strategy :
6967 fail-fast : false
7068 matrix :
71- build : [linux] # , linux-arm64, freebsd]
69+ build : [linux, linux-arm64, freebsd]
7270 include :
7371 - build : linux
7472 arch : amd64
7573 os : Linux
7674 target : x86_64-unknown-linux-gnu
77- # - build: linux-arm64
78- # arch: arm64
79- # os: Linux
80- # target: aarch64-unknown-linux-gnu
81- # - build: freebsd
82- # arch: amd64
83- # os: Linux
84- # target: x86_64-unknown-freebsd
75+ - build : linux-arm64
76+ arch : arm64
77+ os : Linux
78+ target : aarch64-unknown-linux-gnu
79+ - build : freebsd
80+ arch : amd64
81+ os : Linux
82+ target : x86_64-unknown-freebsd
8583 steps :
8684 # Store the version, stripping any v-prefix
87- # - name: Write release version
88- # run: |
89- # VERSION=${GITHUB_REF_NAME#v}
90- # echo Version: $VERSION
91- # echo "VERSION=$VERSION" >> $GITHUB_ENV
9285 - name : Write release version
9386 run : |
9487 VERSION=${GITHUB_REF_NAME#v}
9588 echo Version: $VERSION
96- echo "VERSION=1.5.1 " >> $GITHUB_ENV
89+ echo "VERSION=$VERSION " >> $GITHUB_ENV
9790
9891 - name : Checkout
9992 uses : actions/checkout@v4
@@ -183,6 +176,7 @@ jobs:
183176 asset_path : defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.deb
184177 asset_name : defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.deb
185178 asset_content_type : application/octet-stream
179+
186180 - name : Upload DEB to apt repository
187181 if : matrix.build == 'linux'
188182 run : |
@@ -191,44 +185,43 @@ jobs:
191185
192186 deb-s3 upload -l --bucket=apt.defguard.net --access-key-id=${{ secrets.AWS_ACCESS_KEY_APT }} --secret-access-key=${{ secrets.AWS_SECRET_KEY_APT }} --s3-region=eu-north-1 --no-fail-if-exists --codename=trixie --component="$COMPONENT" defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.deb
193187
194-
195188 - name : Run `packer init`
196189 if : matrix.build == 'linux' && matrix.arch == 'amd64'
197190 id : init
198191 run : " packer init ./images/ami/proxy.pkr.hcl"
199192
200- # - name: Build AMI images for multiple regions
201- # if: matrix.build == 'linux' && matrix.arch == 'amd64'
202- # run: |
203- # regions=(us-east-1 eu-west-1 ap-northeast-1 eu-central-1)
204- # for region in "${regions[@]}"; do
205- # echo "Building AMI for region: $region"
206- # echo "Running packer validate for $region..."
207- # packer validate --var "package_version=${{ env.VERSION }}" --var "region=$region" ./images/ami/proxy.pkr.hcl
208- # echo "Building AMI image for $region..."
209- # packer build -color=false -on-error=abort --var "package_version=${{ env.VERSION }}" --var "region=$region" ./images/ami/proxy.pkr.hcl
210- # done
211- # env:
212- # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
213- # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
193+ - name : Build AMI images for multiple regions
194+ if : matrix.build == 'linux' && matrix.arch == 'amd64'
195+ run : |
196+ regions=(us-east-1 eu-west-1 ap-northeast-1 eu-central-1)
197+ for region in "${regions[@]}"; do
198+ echo "Building AMI for region: $region"
199+ echo "Running packer validate for $region..."
200+ packer validate --var "package_version=${{ env.VERSION }}" --var "region=$region" ./images/ami/proxy.pkr.hcl
201+ echo "Building AMI image for $region..."
202+ packer build -color=false -on-error=abort --var "package_version=${{ env.VERSION }}" --var "region=$region" ./images/ami/proxy.pkr.hcl
203+ done
204+ env :
205+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
206+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
214207
215- # - name: Build RPM package
216- # if: matrix.build == 'linux'
217- # uses: bpicode/github-action-fpm@master
218- # with:
219- # fpm_args: "defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}=/usr/bin/defguard-proxy defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service example-config.toml=/etc/defguard/proxy.toml"
220- # fpm_opts: "--architecture ${{ matrix.arch }} --debug --output-type rpm --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm"
208+ - name : Build RPM package
209+ if : matrix.build == 'linux'
210+ uses : bpicode/github-action-fpm@master
211+ with :
212+ fpm_args : " defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}=/usr/bin/defguard-proxy defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service example-config.toml=/etc/defguard/proxy.toml"
213+ fpm_opts : " --architecture ${{ matrix.arch }} --debug --output-type rpm --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm"
221214
222- # - name: Upload RPM
223- # if: matrix.build == 'linux'
224- # uses: actions/upload-release-asset@v1.0.2
225- # env:
226- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
227- # with:
228- # upload_url: ${{ needs.create-release.outputs.upload_url }}
229- # asset_path: defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
230- # asset_name: defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
231- # asset_content_type: application/octet-stream
215+ - name : Upload RPM
216+ if : matrix.build == 'linux'
217+ uses : actions/upload-release-asset@v1.0.2
218+ env :
219+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
220+ with :
221+ upload_url : ${{ needs.create-release.outputs.upload_url }}
222+ asset_path : defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
223+ asset_name : defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
224+ asset_content_type : application/octet-stream
232225
233226 apt-sign :
234227 needs :
0 commit comments