Skip to content

Commit f8aa403

Browse files
Add ubuntu 22.04 apt upload pipeline (#645)
* release ubuntu client * add run on branch * tauri action version change * fix version variable * remove sudo * add sudo to apt-sign * job for building ubuntu22.04 client with apt uploading/signing * Update release.yaml --------- Co-authored-by: Aleksander <[email protected]>
1 parent c9f89f3 commit f8aa403

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

.github/workflows/release.yaml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
run: |
120120
apt-get install -y build-essential libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libxdo-dev unzip protobuf-compiler libprotobuf-dev rpm
121121
- name: Build packages
122-
uses: tauri-apps/tauri-action@v0
122+
uses: tauri-apps/tauri-action@v0.5.23
123123
env:
124124
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125125
with:
@@ -133,6 +133,18 @@ jobs:
133133
asset_path: src-tauri/target/release/bundle/deb/defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}.deb
134134
asset_name: defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb
135135
asset_content_type: application/octet-stream
136+
- name: Install ruby with deb-s3
137+
if: matrix.build != 'freebsd'
138+
run: |
139+
apt-get install -y ruby
140+
gem install deb-s3
141+
echo "$(ruby -r rubygems -e 'puts Gem.user_dir')/bin" >> $GITHUB_PATH
142+
- name: Upload DEB to APT repository
143+
run: |
144+
COMPONENT=$([[ "${{ github.ref_name }}" == *"-"* ]] && echo "pre-release" || echo "release") # if tag contain "-" assume it's pre-release.
145+
146+
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=bookworm --component="$COMPONENT" src-tauri/target/release/bundle/deb/defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}.deb
147+
136148
137149
build-linux:
138150
needs:
@@ -519,3 +531,40 @@ jobs:
519531
asset_path: defguard-client-signed.exe
520532
asset_name: defguard-client_${{ env.VERSION }}_x64_en-US.exe
521533
asset_content_type: application/octet-stream
534+
535+
apt-sign:
536+
needs:
537+
- build-linux
538+
- ubuntu-22-04-build
539+
runs-on:
540+
- self-hosted
541+
- Linux
542+
- X64
543+
strategy:
544+
fail-fast: false
545+
steps:
546+
- name: Sign APT repository
547+
run: |
548+
export AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_APT }}
549+
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_KEY_APT }}
550+
export AWS_REGION=eu-north-1
551+
sudo apt update -y
552+
sudo apt install -y awscli curl jq
553+
554+
for DIST in trixie bookworm; do
555+
aws s3 cp s3://apt.defguard.net/dists/${DIST}/Release .
556+
557+
curl -X POST "${{ secrets.DEFGUARD_SIGNING_URL }}?signature_type=both" \
558+
-H "Authorization: Bearer ${{ secrets.DEFGUARD_SIGNING_API_KEY }}" \
559+
-F "file=@Release" \
560+
-o response.json
561+
562+
cat response.json | jq -r '.files["Release.gpg"].content' | base64 --decode > Release.gpg
563+
cat response.json | jq -r '.files.Release.content' | base64 --decode > InRelease
564+
565+
aws s3 cp Release.gpg s3://apt.defguard.net/dists/${DIST}/ --acl public-read
566+
aws s3 cp InRelease s3://apt.defguard.net/dists/${DIST}/ --acl public-read
567+
568+
done
569+
(aws s3 ls s3://apt.defguard.net/dists/ --recursive; aws s3 ls s3://apt.defguard.net/pool/ --recursive) | awk '{print "<a href=\""$4"\">"$4"</a><br>"}' > index.html
570+
aws s3 cp index.html s3://apt.defguard.net/ --acl public-read

0 commit comments

Comments
 (0)