From bc5d40f68af896659b41ffaf92eb8edc4f80f6e3 Mon Sep 17 00:00:00 2001 From: Marty Oehme <contact@martyoeh.me> Date: Thu, 6 Mar 2025 09:20:54 +0100 Subject: [PATCH] Create separate deploy job --- .github/workflows/build.yaml | 51 ++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8c15539..f54c11c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -94,6 +94,7 @@ jobs: - name: copy run: cp -rv added-packages/srcpkgs/* srcpkgs + # TODO: Implement cache? - name: Prepare masterdir run: | chown -R builder:builder . && @@ -112,6 +113,13 @@ jobs: - name: Show files run: sudo -Eu builder common/travis/show_files.sh "$BOOTSTRAP" "$ARCH" + - name: Archive xbps artifacts + uses: actions/upload-artifact@v4 + with: + name: binaries-${{ matrix.config.arch }}-${{ matrix.config.libc }} + path: | + hostdir/binpkgs/*.xbps + # - name: Compare to previous # run: sudo -Eu builder common/travis/xpkgdiff.sh "$BOOTSTRAP" "$ARCH" @@ -130,8 +138,41 @@ jobs: # chown builder:builder /check-install && # sudo -Eu builder common/travis/check-install.sh "$BOOTSTRAP" "$ARCH" + deploy: + name: Deploy repository + runs-on: ubuntu-latest + needs: [ build ] + if: "github.ref == 'refs/heads/main' && !contains(github.event.pull_request.title, '[ci skip]') && !contains(github.event.pull_request.body, '[ci skip]')" + + container: + image: ghcr.io/void-linux/void-glibc-full:20250227R1 + options: --privileged + + steps: + - name: Prepare container + run: | + # switch to repo-ci mirror + mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/ + sed -i 's|repo-default|repo-ci|g' /etc/xbps.d/*-repository-*.conf + # install dependencies + xbps-install -Syu xbps && xbps-install -yu && xbps-install -y sudo bash curl git git-lfs + # create non-root user + useradd -G xbuilder -M builder + + - name: Checkout existing repo + uses: actions/checkout@v4 + with: + ref: gh-pages + lfs: true + + - uses: actions/download-artifact@v4 + with: + pattern: binaries-* + merge-multiple: true + - name: Show downloaded files + run: ls -R . + - name: sign - working-directory: hostdir/binpkgs/ run: | xbps-rindex -r $PWD @@ -143,13 +184,11 @@ jobs: xbps-rindex -c $PWD - name: checksum - working-directory: hostdir/binpkgs/ run: | for pkg in *.xbps; do sha256sum "$pkg" | tee "$pkg".sha256sum; done for pkg in *.xbps; do sha512sum "$pkg" | tee "$pkg".sha512sum; done - name: Create simple index page for repo - working-directory: hostdir/binpkgs/ run: | echo '<html><head><title>Index of /</title></head> <body><h1>Index of /</h1><hr><pre>' > index.html for pkg in *.xbps; do echo "<a href=\"${pkg}}\">${pkg}</a>" >> index.html; done @@ -157,10 +196,6 @@ jobs: - name: publish to pages uses: peaceiris/actions-gh-pages@v4 - # If you're changing the branch from main, - # also change the `main` in `refs/heads/main` - # below accordingly. - if: github.ref == 'refs/heads/main' with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: hostdir/binpkgs + publish_dir: .