|
3 | 3 | push: |
4 | 4 | tags: |
5 | 5 | - v*.*.* |
6 | | - |
7 | 6 | jobs: |
8 | 7 | create-release: |
9 | 8 | name: create-release |
|
23 | 22 | uses: ./.github/workflows/sbom.yml |
24 | 23 | with: |
25 | 24 | upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 25 | + ubuntu-22-04-build: |
| 26 | + needs: |
| 27 | + - create-release |
| 28 | + runs-on: |
| 29 | + - self-hosted |
| 30 | + - Linux |
| 31 | + - ${{ matrix.architecture }} |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + architecture: [ARM64, X64] |
| 36 | + include: |
| 37 | + - architecture: ARM64 |
| 38 | + deb_arch: arm64 |
| 39 | + binary_arch: aarch64 |
| 40 | + - architecture: X64 |
| 41 | + deb_arch: amd64 |
| 42 | + binary_arch: x86_64 |
| 43 | + container: |
| 44 | + image: ubuntu:22.04 |
| 45 | + env: |
| 46 | + DEBIAN_FRONTEND: noninteractive |
| 47 | + HOME: /root |
| 48 | + RUSTUP_HOME: /root/.rustup |
| 49 | + CARGO_HOME: /root/.cargo |
| 50 | + steps: |
| 51 | + - name: git install |
| 52 | + run: | |
| 53 | + apt-get update |
| 54 | + apt-get install -y git curl ca-certificates |
| 55 | + git config --global --add safe.directory '*' |
| 56 | + - uses: actions/checkout@v5 |
| 57 | + with: |
| 58 | + submodules: "recursive" |
| 59 | + - uses: pnpm/action-setup@v4 |
| 60 | + with: |
| 61 | + version: 10.17 |
| 62 | + run_install: false |
| 63 | + - uses: actions/setup-node@v5 |
| 64 | + with: |
| 65 | + node-version: "24" |
| 66 | + - name: Get pnpm store directory |
| 67 | + run: | |
| 68 | + echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV} |
| 69 | + - name: Write release version |
| 70 | + run: | |
| 71 | + VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1) |
| 72 | + echo Version: $VERSION |
| 73 | + echo "VERSION=$VERSION" >> ${GITHUB_ENV} |
| 74 | + - uses: actions/cache@v4 |
| 75 | + name: Setup pnpm cache |
| 76 | + with: |
| 77 | + path: ${{ env.STORE_PATH }} |
| 78 | + key: ${{ runner.os }}-pnpm-build-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 79 | + restore-keys: | |
| 80 | + ${{ runner.os }}-pnpm-build-store- |
| 81 | + - name: Install Node dependencies |
| 82 | + run: pnpm install --frozen-lockfile |
| 83 | + - uses: dtolnay/rust-toolchain@stable |
| 84 | + - name: Install dependencies |
| 85 | + run: | |
| 86 | + 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 |
| 87 | + - name: Build packages |
| 88 | + uses: tauri-apps/tauri-action@v0.5.23 |
| 89 | + env: |
| 90 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + with: |
| 92 | + args: "--bundles deb" |
| 93 | + - name: Upload DEB |
| 94 | + uses: actions/upload-release-asset@v1 |
| 95 | + env: |
| 96 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 97 | + with: |
| 98 | + upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 99 | + asset_path: src-tauri/target/release/bundle/deb/defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}.deb |
| 100 | + asset_name: defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb |
| 101 | + asset_content_type: application/octet-stream |
| 102 | + - name: Install ruby with deb-s3 |
| 103 | + if: matrix.build != 'freebsd' |
| 104 | + run: | |
| 105 | + apt-get install -y ruby |
| 106 | + gem install deb-s3 |
| 107 | + echo "$(ruby -r rubygems -e 'puts Gem.user_dir')/bin" >> $GITHUB_PATH |
| 108 | + - name: Upload DEB to APT repository |
| 109 | + run: | |
| 110 | + COMPONENT=$([[ "${{ github.ref_name }}" == *"-"* ]] && echo "pre-release" || echo "release") # if tag contain "-" assume it's pre-release. |
| 111 | +
|
| 112 | + 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 |
| 113 | + |
26 | 114 |
|
27 | 115 | build-linux: |
28 | 116 | needs: |
@@ -468,3 +556,40 @@ jobs: |
468 | 556 | asset_path: defguard-client-signed.msi |
469 | 557 | asset_name: defguard-client_${{ env.VERSION }}_x64_en-US.msi |
470 | 558 | asset_content_type: application/octet-stream |
| 559 | + |
| 560 | + apt-sign: |
| 561 | + needs: |
| 562 | + - build-linux |
| 563 | + - ubuntu-22-04-build |
| 564 | + runs-on: |
| 565 | + - self-hosted |
| 566 | + - Linux |
| 567 | + - X64 |
| 568 | + strategy: |
| 569 | + fail-fast: false |
| 570 | + steps: |
| 571 | + - name: Sign APT repository |
| 572 | + run: | |
| 573 | + export AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_APT }} |
| 574 | + export AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_KEY_APT }} |
| 575 | + export AWS_REGION=eu-north-1 |
| 576 | + sudo apt update -y |
| 577 | + sudo apt install -y awscli curl jq |
| 578 | +
|
| 579 | + for DIST in trixie bookworm; do |
| 580 | + aws s3 cp s3://apt.defguard.net/dists/${DIST}/Release . |
| 581 | + |
| 582 | + curl -X POST "${{ secrets.DEFGUARD_SIGNING_URL }}?signature_type=both" \ |
| 583 | + -H "Authorization: Bearer ${{ secrets.DEFGUARD_SIGNING_API_KEY }}" \ |
| 584 | + -F "file=@Release" \ |
| 585 | + -o response.json |
| 586 | + |
| 587 | + cat response.json | jq -r '.files["Release.gpg"].content' | base64 --decode > Release.gpg |
| 588 | + cat response.json | jq -r '.files.Release.content' | base64 --decode > InRelease |
| 589 | + |
| 590 | + aws s3 cp Release.gpg s3://apt.defguard.net/dists/${DIST}/ --acl public-read |
| 591 | + aws s3 cp InRelease s3://apt.defguard.net/dists/${DIST}/ --acl public-read |
| 592 | +
|
| 593 | + done |
| 594 | + (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 |
| 595 | + aws s3 cp index.html s3://apt.defguard.net/ --acl public-read |
0 commit comments