Skip to content

Update Repo

Update Repo #533

Workflow file for this run

name: Update Repo
permissions:
contents: write
on:
workflow_dispatch:
workflow_call:
workflow_run:
workflows: [Build VF2 Kernel]
types: [completed]
#workflow_dispatch:
#workflow_call:
# secrets:
# GPG_PRIVATE_KEY:
# description: 'GPG Private Key'
# required: True
# GPG_PUBLIC_KEY:
# description: 'GPG Public Key'
# required: True
# GPG_PRIVATE_KEY_PASSWORD:
# description: 'GPG Private Key Password'
# required: True
jobs:
publish_apt:
runs-on: ubuntu-latest
#runs-on: self-hosted
if: ${{ github.event.workflow_run.conclusion == 'success' }}
container:
image: ubuntu:latest
options: --user root
steps:
- name: Install dependencies
run: |
apt update
apt install -y apt-utils git curl jq unzip gpg dpkg-dev
- name: Checkout
uses: actions/checkout@v3
with:
ref: apt
fetch-depth: 1
# - name: Restore Cached Debs
# id: cache-debs-restore
# uses: actions/cache@v3
# with:
# path: /tmp/
# key: "deb-cache-${{ github.run_id }}"
- name: Find Artifact
id: find_artifact
run: |
echo "artifact_id=$(curl -s -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{secrets.GITHUB_TOKEN}}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/agreenbhm/linux/actions/artifacts?name=compiled_vf2_debs | jq .artifacts[0].id)" >> $GITHUB_OUTPUT
- name: Download Artifact
run: |
curl -L -o /tmp/artifact.zip -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/agreenbhm/linux/actions/artifacts/${{ steps.find_artifact.outputs.artifact_id }}/zip
- name: Extract Artifact
run: |
cd /tmp/
unzip artifact.zip
- name: Replace repo .deb files
run: |
rm -f ./repo/riscv64/*.deb
#rm -f ./repo/pool/main/*.deb
#mv /tmp/*.deb ./repo/pool/main/
mv /tmp/*.deb ./repo/riscv64/
- name: Create Packages and Release manifests
run: |
cd ./repo/riscv64
dpkg-scanpackages -a riscv64 . > Packages
apt-ftparchive release . > Release
- name: Sign Repo
env:
GPG_PRIVATE_KEY: "${{ secrets.GPG_PRIVATE_KEY }}"
GPG_PUBLIC_KEY: "${{ secrets.GPG_PUBLIC_KEY }}"
GPG_PRIVATE_KEY_PASSWORD: "${{ secrets.GPG_PRIVATE_KEY_PASSWORD }}"
run: |
export GPG_TTY=$(tty)
echo $GPG_PRIVATE_KEY | base64 --decode | gpg --batch --pinentry-mode=loopback --yes --passphrase "$GPG_PRIVATE_KEY_PASSWORD" --import
gpg -a --batch --clearsign --output ./repo/riscv64/InRelease --detach-sign --pinentry-mode=loopback --yes --passphrase "$GPG_PRIVATE_KEY_PASSWORD" ./repo/riscv64/Release
- name: Git Add/Commit/Push repo to GH
run: |
echo `pwd`
chown -R root:root .
git config --global user.email "[email protected]"
git config --global user.name "Merge Upstream Action"
git add .
git commit -m "Updating apt repo" --no-edit
git push origin apt