From 264539bae74dd91d176a7e3840c00efbf924b97a Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Tue, 18 Feb 2020 01:27:28 +0100 Subject: [PATCH] Use new repo-update method for Fedora --- .github/workflows/arch.yml | 4 +- .github/workflows/debian.yml | 5 ++- .github/workflows/fedora-30.yml | 71 ++++++++++++--------------------- .github/workflows/fedora-31.yml | 71 ++++++++++++--------------------- 4 files changed, 55 insertions(+), 96 deletions(-) diff --git a/.github/workflows/arch.yml b/.github/workflows/arch.yml index 851fa3dc3..7b028a5c8 100644 --- a/.github/workflows/arch.yml +++ b/.github/workflows/arch.yml @@ -76,11 +76,11 @@ jobs: name: Update package repository needs: [build] runs-on: ubuntu-latest + container: archlinux steps: - name: Install dependencies run: | - sudo apt-get update - sudo apt-get install -y git + pacman -Sy --noconfirm git - name: Download artifacts uses: actions/download-artifact@v1 diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index 82b9b04a5..336592833 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -119,11 +119,12 @@ jobs: name: Update package repository needs: [build] runs-on: ubuntu-latest + container: debian:sid steps: - name: Install dependencies run: | - sudo apt-get update - sudo apt-get install -y git + apt-get update + apt-get install -y git - name: Download artifacts uses: actions/download-artifact@v1 diff --git a/.github/workflows/fedora-30.yml b/.github/workflows/fedora-30.yml index 5541bce15..396f8fb89 100644 --- a/.github/workflows/fedora-30.yml +++ b/.github/workflows/fedora-30.yml @@ -66,26 +66,7 @@ jobs: steps: - name: Install dependencies run: | - dnf install -y createrepo_c git findutils wget - - - name: Checkout repository - uses: actions/checkout@v2 - with: - repository: linux-surface/repo - token: ${{ secrets.GITHUB_BOT_TOKEN }} - fetch-depth: 0 - ref: master - - - name: Unpack repository - run: | - cd fedora/f30 - - for blob in $(find . -name '*.blob'); do - blobref="$(cat $blob)" - repo="${blobref%%:*}" - vers="${blobref#*:}" - wget "https://github.com/linux-surface/$repo/releases/download/$vers" - done + dnf install -y git - name: Download artifacts uses: actions/download-artifact@v1 @@ -94,40 +75,38 @@ jobs: - name: Update repository env: - GPG_KEY: ${{ secrets.SURFACE_GPG_KEY }} + SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }} + BRANCH_STAGING: autoupd/staging GIT_REF: ${{ github.ref }} run: | - # Parse git tag from ref + repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git" + + # clone package repository + git clone -b "${BRANCH_STAGING}" "${repo}" repo + + # copy packages + cp fedora-30-latest/* repo/fedora/f30 + cd repo/fedora/f30 + + # parse git tag from ref GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g') - for pkg in $(find fedora-30-latest -name '*.rpm'); do + # convert packages into references + for pkg in $(find . -name '*.pkg.tar.zst'); do echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob + rm $pkg done - cp fedora-30-latest/* fedora/f30/ - rm -r fedora-30-latest + # set git identity + git config --global user.email "surfacebot@users.noreply.github.com" + git config --global user.name "surfacebot" - cd fedora/f30 - createrepo_c --xz --update --verbose . - - # Sign the updated repository - echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes - if [ -f 'repodata/repomd.xml.asc' ]; then - rm repodata/repomd.xml.asc - fi - gpg --detach-sign --batch --no-tty --armor -u $GPG_KEY_ID repodata/repomd.xml - - - name: Commit and push - uses: github-actions-x/commit@v2.3 - with: - github-token: ${{ secrets.GITHUB_BOT_TOKEN }} - push-branch: master - commit-message: Update f30 kernel - force-add: false - rebase: true - files: fedora/f30/* - name: surfacebot - email: surfacebot@users.noreply.github.com + # commit and push + update_branch="${BRANCH_STAGING}-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)" + git switch -c "${update_branch}" + git add . + git commit -m "Update Fedora 30 kernel" + git push --set-upstream origin "${update_branch}" release: name: Publish release diff --git a/.github/workflows/fedora-31.yml b/.github/workflows/fedora-31.yml index 02a4e8bee..293e22a9e 100644 --- a/.github/workflows/fedora-31.yml +++ b/.github/workflows/fedora-31.yml @@ -66,26 +66,7 @@ jobs: steps: - name: Install dependencies run: | - dnf install -y createrepo_c git findutils wget - - - name: Checkout repository - uses: actions/checkout@v2 - with: - repository: linux-surface/repo - token: ${{ secrets.GITHUB_BOT_TOKEN }} - fetch-depth: 0 - ref: master - - - name: Unpack repository - run: | - cd fedora/f31 - - for blob in $(find . -name '*.blob'); do - blobref="$(cat $blob)" - repo="${blobref%%:*}" - vers="${blobref#*:}" - wget "https://github.com/linux-surface/$repo/releases/download/$vers" - done + dnf install -y git - name: Download artifacts uses: actions/download-artifact@v1 @@ -94,40 +75,38 @@ jobs: - name: Update repository env: - GPG_KEY: ${{ secrets.SURFACE_GPG_KEY }} + SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }} + BRANCH_STAGING: autoupd/staging GIT_REF: ${{ github.ref }} run: | - # Parse git tag from ref + repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git" + + # clone package repository + git clone -b "${BRANCH_STAGING}" "${repo}" repo + + # copy packages + cp fedora-31-latest/* repo/fedora/f31 + cd repo/fedora/f31 + + # parse git tag from ref GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g') - for pkg in $(find fedora-31-latest -name '*.rpm'); do + # convert packages into references + for pkg in $(find . -name '*.pkg.tar.zst'); do echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob + rm $pkg done - cp fedora-31-latest/* fedora/f31/ - rm -r fedora-31-latest + # set git identity + git config --global user.email "surfacebot@users.noreply.github.com" + git config --global user.name "surfacebot" - cd fedora/f31 - createrepo_c --xz --update --verbose . - - # Sign the updated repository - echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes - if [ -f 'repodata/repomd.xml.asc' ]; then - rm repodata/repomd.xml.asc - fi - gpg --detach-sign --batch --no-tty --armor -u $GPG_KEY_ID repodata/repomd.xml - - - name: Commit and push - uses: github-actions-x/commit@v2.3 - with: - github-token: ${{ secrets.GITHUB_BOT_TOKEN }} - push-branch: master - commit-message: Update f31 kernel - force-add: false - rebase: true - files: fedora/f31/* - name: surfacebot - email: surfacebot@users.noreply.github.com + # commit and push + update_branch="${BRANCH_STAGING}-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)" + git switch -c "${update_branch}" + git add . + git commit -m "Update Fedora 31 kernel" + git push --set-upstream origin "${update_branch}" release: name: Publish release