Skip to content

Bump the production group across 3 directories with 4 updates #563

Bump the production group across 3 directories with 4 updates

Bump the production group across 3 directories with 4 updates #563

Workflow file for this run

name: Automated release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
extract-debian-packages:
name: Extract debian packages
runs-on: ubuntu-24.04
outputs:
crates: ${{ steps.cargo-metadata.outputs.crates }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a
with:
toolchain: stable
- id: cargo-metadata
run: |
DEBIAN_PACKAGES=$(cargo metadata --no-deps --format-version=1 | jq -c '[.packages[] | select(.metadata.deb) | {name, version, deb_name: (.metadata.deb.name // .name)}]')
echo "crates=$DEBIAN_PACKAGES" >> $GITHUB_OUTPUT
build-debian:
name: Build debian package ${{ matrix.crate.deb_name }} for ${{ matrix.target.arch }}
runs-on: ubuntu-24.04
needs:
- extract-debian-packages
env:
GH_TOKEN: ${{ github.token }}
POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }}
strategy:
fail-fast: false
matrix:
crate: ${{ fromJSON(needs.extract-debian-packages.outputs.crates) }}
target:
- target: x86_64-unknown-linux-gnu
arch: amd64
- target: aarch64-unknown-linux-gnu
arch: arm64
steps:
- uses: actions/checkout@v4
- name: Install Protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: taiki-e/cache-cargo-install-action@44857e0ff6d186da8fe49f9ac9eedae5bbc37a93
with:
tool: cargo-deb
- name: Install cross compile linker
if: ${{ matrix.target.arch == 'arm64' }}
uses: awalsh128/cache-apt-pkgs-action@5902b33ae29014e6ca012c5d8025d4346556bd40 # v1.4.3
with:
packages: gcc-aarch64-linux-gnu
version: 1.0
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target.target }}--${{ matrix.crate.name }}
- name: Build debian package
run: cargo deb -p ${{ matrix.crate.name }} --target ${{ matrix.target.target }}
- name: Upload artifacts
id: upload-artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.crate.name }}--${{ matrix.target.arch }}.deb
path: target/${{ matrix.target.target }}/debian/*.deb
create-release:
name: Create a release
runs-on: ubuntu-24.04
needs:
- build-debian
env:
GH_TOKEN: ${{ github.token }}
permissions:
contents: write
attestations: read
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Install APT packages
uses: awalsh128/cache-apt-pkgs-action@5902b33ae29014e6ca012c5d8025d4346556bd40 # v1.4.3
with:
packages: apt-utils
version: 1.0
- name: Import GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
with:
gpg_private_key: ${{ secrets.APT_REPO_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.APT_REPO_GPG_PRIVATE_KEY_PW }}
# For each combination of crate and target download the artifact
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: apt-repo
pattern: "*--*.deb"
merge-multiple: true
- name: List packages
run: ls -R ./apt-repo/
- name: Create repository
run: |
cd apt-repo
dpkg-scanpackages -m . > Packages
sed -i Packages -e 's|Filename: \./|Filename: |'
gzip -k -f Packages
touch Release
echo "Origin: P2P Industries Repository" >> Release
echo "Label: unstable" >> Release
echo "Suite: unstable" >> Release
echo "Codename: unstable" >> Release
echo "Architectures: amd64 arm64" >> Release
echo "components: main" >> Release
apt-ftparchive release . >> Release
gpg --default-key ${{ steps.import-gpg.outputs.keyid }} -abs -o - Release > Release.gpg
gpg --default-key ${{ steps.import-gpg.outputs.keyid }} --clearsign -o - Release > InRelease
- name: Create release
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # 2.2.1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./apt-repo/*