Browse Source

Update repo-update process

Maximilian Luz 5 years ago
parent
commit
468947a822

+ 1 - 1
.github/workflows/arch.yml

@@ -90,7 +90,7 @@ jobs:
     - name: Update repository
     - name: Update repository
       env:
       env:
         SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }}
         SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }}
-        BRANCH_STAGING: autoupd/staging
+        BRANCH_STAGING: u/staging
         GIT_REF: ${{ github.ref }}
         GIT_REF: ${{ github.ref }}
       run: |
       run: |
         repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
         repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"

+ 21 - 39
.github/workflows/arch_lts.yml

@@ -82,14 +82,6 @@ jobs:
       run: |
       run: |
         pacman -Sy --noconfirm base-devel git
         pacman -Sy --noconfirm base-devel git
 
 
-    - name: Checkout repository
-      uses: actions/checkout@v2
-      with:
-        repository: linux-surface/repo
-        token: ${{ secrets.GITHUB_BOT_TOKEN }}
-        fetch-depth: 0
-        ref: master
-
     - name: Download artifacts
     - name: Download artifacts
       uses: actions/download-artifact@v1
       uses: actions/download-artifact@v1
       with:
       with:
@@ -97,48 +89,38 @@ jobs:
 
 
     - name: Update repository
     - name: Update repository
       env:
       env:
-        GPG_KEY: ${{ secrets.SURFACE_GPG_KEY }}
+        SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }}
+        BRANCH_STAGING: u/staging
         GIT_REF: ${{ github.ref }}
         GIT_REF: ${{ github.ref }}
       run: |
       run: |
-        cp arch-latest/* arch/
-        rm -r arch-latest
+        repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
 
 
-        cd arch
-        repo-add -n linux-surface.db.tar.gz *.pkg.tar.zst
+        # clone package repository
+        git clone -b "${BRANCH_STAGING}" "${repo}" repo
 
 
-        # Sign the updated repository
-        echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes
-        if [ -f 'linux-surface.db.sig' ]; then
-          rm linux-surface.db.sig
-          rm linux-surface.db.tar.gz.sig
-          rm linux-surface.files.sig
-          rm linux-surface.files.tar.gz.sig
-        fi
-        gpg --detach-sign --batch --no-tty --no-armor -u $GPG_KEY_ID linux-surface.db
-        gpg --detach-sign --batch --no-tty --no-armor -u $GPG_KEY_ID linux-surface.db.tar.gz
-        gpg --detach-sign --batch --no-tty --no-armor -u $GPG_KEY_ID linux-surface.files
-        gpg --detach-sign --batch --no-tty --no-armor -u $GPG_KEY_ID linux-surface.files.tar.gz
-
-        # Parse git tag from ref
+        # copy packages
+        cp arch-latest/* repo/arch/
+        cd repo/arch
+
+        # parse git tag from ref
         GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
         GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
 
 
-        # Convert packages into references
+        # convert packages into references
         for pkg in $(find . -name '*.pkg.tar.zst'); do
         for pkg in $(find . -name '*.pkg.tar.zst'); do
           echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob
           echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob
           rm $pkg
           rm $pkg
         done
         done
 
 
-    - name: Commit and push
-      uses: github-actions-x/commit@v2.3
-      with:
-        github-token: ${{ secrets.GITHUB_BOT_TOKEN }}
-        push-branch: master
-        commit-message: Update arch lts kernel
-        force-add: false
-        rebase: true
-        files: arch/*
-        name: surfacebot
-        email: surfacebot@users.noreply.github.com
+        # set git identity
+        git config --global user.email "surfacebot@users.noreply.github.com"
+        git config --global user.name "surfacebot"
+
+        # 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 Arch Linux LTS kernel"
+        git push --set-upstream origin "${update_branch}"
 
 
   release:
   release:
     name: Publish release
     name: Publish release

+ 1 - 1
.github/workflows/debian.yml

@@ -134,7 +134,7 @@ jobs:
     - name: Update repository
     - name: Update repository
       env:
       env:
         SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }}
         SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }}
-        BRANCH_STAGING: autoupd/staging
+        BRANCH_STAGING: u/staging
         GIT_REF: ${{ github.ref }}
         GIT_REF: ${{ github.ref }}
       run: |
       run: |
         repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
         repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"

+ 20 - 30
.github/workflows/debian_lts.yml

@@ -126,14 +126,6 @@ jobs:
         apt-get update
         apt-get update
         apt-get install -y reprepro git
         apt-get install -y reprepro git
 
 
-    - name: Checkout repository
-      uses: actions/checkout@v2
-      with:
-        repository: linux-surface/repo
-        token: ${{ secrets.GITHUB_BOT_TOKEN }}
-        fetch-depth: 0
-        ref: master
-
     - name: Download artifacts
     - name: Download artifacts
       uses: actions/download-artifact@v1
       uses: actions/download-artifact@v1
       with:
       with:
@@ -141,40 +133,38 @@ jobs:
 
 
     - name: Update repository
     - name: Update repository
       env:
       env:
-        GPG_KEY: ${{ secrets.SURFACE_GPG_KEY }}
+        SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }}
+        BRANCH_STAGING: u/staging
         GIT_REF: ${{ github.ref }}
         GIT_REF: ${{ github.ref }}
       run: |
       run: |
-        cd debian
+        repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
 
 
-        # Import the GPG key for signing the repository
-        echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes
+        # clone package repository
+        git clone -b "${BRANCH_STAGING}" "${repo}" repo
 
 
-        # Add packages to repository
-        for pkg in ../debian-latest/*.deb; do
-          reprepro --basedir . --component main includedeb release $pkg
-        done
-        rm -r ../debian-latest
+        # copy packages
+        cp debian-latest/* repo/debian/
+        cd repo/debian
 
 
-        # Parse git tag from ref
+        # parse git tag from ref
         GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
         GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
 
 
-        # Convert packages into references
+        # convert packages into references
         for pkg in $(find . -name '*.deb'); do
         for pkg in $(find . -name '*.deb'); do
           echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob
           echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob
           rm $pkg
           rm $pkg
         done
         done
 
 
-    - name: Commit and push
-      uses: github-actions-x/commit@v2.3
-      with:
-        github-token: ${{ secrets.GITHUB_BOT_TOKEN }}
-        push-branch: master
-        commit-message: Update debian lts kernel
-        force-add: false
-        rebase: true
-        files: debian/*
-        name: surfacebot
-        email: surfacebot@users.noreply.github.com
+        # set git identity
+        git config --global user.email "surfacebot@users.noreply.github.com"
+        git config --global user.name "surfacebot"
+
+        # 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 Debian LTS kernel"
+        git push --set-upstream origin "${update_branch}"
 
 
   release:
   release:
     name: Publish release
     name: Publish release

+ 1 - 1
.github/workflows/fedora-30.yml

@@ -76,7 +76,7 @@ jobs:
     - name: Update repository
     - name: Update repository
       env:
       env:
         SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }}
         SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }}
-        BRANCH_STAGING: autoupd/staging
+        BRANCH_STAGING: u/staging
         GIT_REF: ${{ github.ref }}
         GIT_REF: ${{ github.ref }}
       run: |
       run: |
         repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
         repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"

+ 1 - 1
.github/workflows/fedora-31.yml

@@ -76,7 +76,7 @@ jobs:
     - name: Update repository
     - name: Update repository
       env:
       env:
         SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }}
         SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }}
-        BRANCH_STAGING: autoupd/staging
+        BRANCH_STAGING: u/staging
         GIT_REF: ${{ github.ref }}
         GIT_REF: ${{ github.ref }}
       run: |
       run: |
         repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
         repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"