on: workflow_call: inputs: runs-on: required: true type: string secrets: GPG_SECRET_SUBKEYS: required: true GPG_SIGNING_SUBKEY_FINGERPRINT: required: true GPG_AUTH_SUBKEY_KEYGRIP: required: true SSH_HOST: required: true SSH_SERVER_KEYS: required: true jobs: linux: concurrency: apt.bcachefs.org runs-on: ${{ inputs.runs-on }} env: CONTAINER_DISTRO: trixie SUITE: ${{ (github.event_name == 'push' && github.ref_type == 'tag') && 'release' || 'snapshot' }} steps: - name: Configure baseline system timeout-minutes: 1 shell: sudo sh "{0}" run: | set -xe mount -t tmpfs tmpfs ${{ github.workspace }} echo "set man-db/auto-update false" | debconf-communicate dpkg-reconfigure man-db mkdir -p /etc/apt/apt.conf.d mkdir -p /etc/dpkg/dpkg.cfg.d tee /etc/apt/apt.conf.d/99gh > /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < EOT cd "${{ github.workspace }}/incoming" find . -type f \( -name '*.deb' -or -name '*.ddeb' \) -print0 | xargs --null -I'{}' sh -c " \ echo '::group::Checking signature on {}' && \ ( \ debsig-verify --verbose {} \ ) && \ echo '::endgroup::' \ " - name: Create and populate repos timeout-minutes: 60 shell: sudo podman exec --interactive --tty container eatmydata sh "{0}" run: | set -xe SNAPSHOT_DATE=`date -u +%Y%m%d%H%M%S` MOUNTPOINT="/home/aptbcachefsorg/uploads" mkdir -p "$MOUNTPOINT" if [ -n "${{ secrets.SSH_HOST }}" ]; then mkdir -p ~/.ssh echo "" >> ~/.gnupg/gpg-agent.conf echo "enable-ssh-support" >> ~/.gnupg/gpg-agent.conf echo "" >> /etc/ssh/ssh_known_hosts echo "${{ secrets.SSH_SERVER_KEYS }}" >> /etc/ssh/ssh_known_hosts gpgconf --kill gpg-agent gpgconf --launch gpg-agent export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) gpg-connect-agent 'keyattr ${{ secrets.GPG_AUTH_SUBKEY_KEYGRIP }} Use-for-ssh: true' /bye sshfs ${{ secrets.SSH_HOST }}/uploads "$MOUNTPOINT" fi rm -f ~/.aptly.conf APTLY_ROOT="$MOUNTPOINT/aptly" PUBLIC_ROOT="$APTLY_ROOT/public" tee -a ~/.aptly.conf < EOT fi setup_env() { REPO_NAME="$DIST-${{ env.SUITE }}" REPO_SUITE="bcachefs-tools-${{ env.SUITE }}" SNAPSHOT_NAME="$REPO_NAME-$SNAPSHOT_DATE" PUBLISH_PREFIX="filesystem:public:$DIST" } cd "${{ github.workspace }}/incoming/bin-artifacts" echo "::group::Adding packages to repositories" for DIST in * do echo "::group::Adding packages to repositories: $DIST" setup_env (aptly repo show $REPO_NAME > /dev/null 2>&1) || \ aptly repo create -distribution=$REPO_SUITE -component=main $REPO_NAME aptly repo include -repo=$REPO_NAME -no-remove-files \ "${{ github.workspace }}/incoming/src-artifacts" \ "${{ github.workspace }}/incoming/bin-artifacts/$DIST" \ ; echo '::endgroup::' done echo '::endgroup::' echo "::group::Creating snapshots of repositories" for DIST in * do echo "::group::Creating snapshots of repositories: $DIST" setup_env aptly snapshot create $SNAPSHOT_NAME from repo $REPO_NAME echo '::endgroup::' done echo '::endgroup::' echo "::group::Publishing repository snapshots" for DIST in * do echo "::group::Publishing repository snapshots: $DIST" setup_env (aptly publish show $REPO_SUITE $PUBLISH_PREFIX > /dev/null 2>&1) || \ aptly publish snapshot -acquire-by-hash -origin="apt.bcachefs.org" -label="apt.bcachefs.org Packages" $SNAPSHOT_NAME $PUBLISH_PREFIX aptly publish switch $REPO_SUITE $PUBLISH_PREFIX $SNAPSHOT_NAME echo '::endgroup::' done echo '::endgroup::' umount "$MOUNTPOINT" || /bin/true