11name : Make a new release
2-
32on :
43 push :
5- tags :
6- - v*.*.*
4+ branches :
5+ - apt_repository
6+ # tags:
7+ # - v*.*.*
78
89concurrency :
910 group : ${{ github.workflow }}-${{ github.ref }}
1011 cancel-in-progress : true
1112
1213jobs :
13- build-docker-release :
14- # Ignore tags with -, like v1.0.0-alpha
15- # This job will build the docker container with the "latest" tag which
16- # is a tag used in production, thus it should only be run for full releases.
17- if : startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-')
18- name : Build Release Docker image
19- uses : ./.github/workflows/build-docker.yml
20- with :
21- tags : |
22- type=raw,value=latest
23- type=semver,pattern={{version}}
24- type=semver,pattern={{major}}.{{minor}}
25- type=sha
26-
27- build-docker-prerelease :
28- # Only build tags with -, like v1.0.0-alpha
29- if : startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-')
30- name : Build Pre-release Docker image
31- uses : ./.github/workflows/build-docker.yml
32- with :
33- tags : |
34- type=raw,value=pre-release
35- type=semver,pattern={{version}}
36- type=sha
37- # Explicitly disable latest tag. It will be added otherwise.
38- flavor : |
39- latest=false
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
4041
4142 create-release :
4243 name : create-release
@@ -47,16 +48,16 @@ jobs:
4748 - name : Create GitHub release
4849 id : release
4950 uses : softprops/action-gh-release@v1
50- if : startsWith(github.ref, 'refs/tags/')
51+ # if: startsWith(github.ref, 'refs/tags/')
5152 with :
5253 draft : true
5354 generate_release_notes : true
5455
55- create-sbom :
56- needs : [create-release, build-docker-release]
57- uses : ./.github/workflows/sbom.yml
58- with :
59- upload_url : ${{ needs.create-release.outputs.upload_url }}
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 }}
6061
6162 build-binaries :
6263 needs : [create-release]
@@ -67,27 +68,32 @@ jobs:
6768 strategy :
6869 fail-fast : false
6970 matrix :
70- build : [linux, linux-arm64, freebsd]
71+ build : [linux] # , linux-arm64, freebsd]
7172 include :
7273 - build : linux
7374 arch : amd64
7475 os : Linux
7576 target : x86_64-unknown-linux-gnu
76- - build : linux-arm64
77- arch : arm64
78- os : Linux
79- target : aarch64-unknown-linux-gnu
80- - build : freebsd
81- arch : amd64
82- os : Linux
83- target : x86_64-unknown-freebsd
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
8485 steps :
8586 # 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
8692 - name : Write release version
8793 run : |
8894 VERSION=${GITHUB_REF_NAME#v}
8995 echo Version: $VERSION
90- echo "VERSION=$VERSION " >> $GITHUB_ENV
96+ echo "VERSION=1.5.1 " >> $GITHUB_ENV
9197
9298 - name : Checkout
9399 uses : actions/checkout@v4
@@ -177,41 +183,49 @@ jobs:
177183 asset_path : defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.deb
178184 asset_name : defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.deb
179185 asset_content_type : application/octet-stream
186+ - name : Upload DEB to apt repository
187+ if : matrix.build == 'linux'
188+ run : |
189+ export PATH="/srv/github/defguard/.local/share/gem/ruby/3.3.0/bin:$PATH"
190+ COMPONENT=$([[ "${{ github.ref_name }}" == *"-"* ]] && echo "pre-release" || echo "release") # if tag contain "-" assume it's pre-release.
191+
192+ deb-s3 upload -l --bucket=apt.defguard.net --access-key-id=${{ secrets.AWS_ACCESS_KEY }} --secret-access-key=${{ secrets.AWS_SECRET_KEY }} --s3-region=eu-north-1 --no-fail-if-exists --codename=trixie --component="$COMPONENT" defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.deb
193+
180194
181195 - name : Run `packer init`
182196 if : matrix.build == 'linux' && matrix.arch == 'amd64'
183197 id : init
184198 run : " packer init ./images/ami/proxy.pkr.hcl"
185199
186- - name : Build AMI images for multiple regions
187- if : matrix.build == 'linux' && matrix.arch == 'amd64'
188- run : |
189- regions=(us-east-1 eu-west-1 ap-northeast-1 eu-central-1)
190- for region in "${regions[@]}"; do
191- echo "Building AMI for region: $region"
192- echo "Running packer validate for $region..."
193- packer validate --var "package_version=${{ env.VERSION }}" --var "region=$region" ./images/ami/proxy.pkr.hcl
194- echo "Building AMI image for $region..."
195- packer build -color=false -on-error=abort --var "package_version=${{ env.VERSION }}" --var "region=$region" ./images/ami/proxy.pkr.hcl
196- done
197- env :
198- AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
199- AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
200-
201- - name : Build RPM package
202- if : matrix.build == 'linux'
203- uses : bpicode/github-action-fpm@master
204- with :
205- 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"
206- fpm_opts : " --architecture ${{ matrix.arch }} --debug --output-type rpm --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm"
207-
208- - name : Upload RPM
209- if : matrix.build == 'linux'
210- 211- env :
212- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
213- with :
214- upload_url : ${{ needs.create-release.outputs.upload_url }}
215- asset_path : defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
216- asset_name : defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
217- asset_content_type : application/octet-stream
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 }}
214+
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"
221+
222+ # - name: Upload RPM
223+ # if: matrix.build == 'linux'
224+ 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
0 commit comments