Automated update #68
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release Void Linux Packages | |
| env: | |
| TAG: workflow-${{ github.run_number }} | |
| SHA: ${{ github.sha }} | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - srcpkgs/** | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # TODO: fix so this workflow can use ubuntu-24.04... https://github.com/actions/runner-images/issues/10636 | |
| jobs: | |
| build: | |
| permissions: | |
| contents: write | |
| strategy: | |
| matrix: | |
| arch: [x86_64, x86_64-musl] | |
| runs-on: ubuntu-22.04 | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| env: | |
| ARCH: ${{ matrix.arch }} | |
| XBPS_ALLOW_RESTRICTED: "yes" | |
| XBPS_TARGET_ARCH: ${{ matrix.arch }} | |
| REPO_OWNER: "${{ github.repository_owner }}" | |
| REPO_NAME: "${{ github.event.repository.name }}" | |
| PATH: "/opt/xbps/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | |
| steps: | |
| - name: More free space | |
| run: | | |
| sudo rm --recursive --force /usr/local/lib/android /usr/share/dotnet /opt/ghc /usr/local/.ghcup /opt/hostedtoolcache/CodeQL | |
| - name: prepare xbps-static | |
| run: | | |
| mkdir -p /opt/xbps | |
| curl --fail -sL http://repo-default.voidlinux.org/static/xbps-static-latest.x86_64-musl.tar.xz \ | |
| | tar -xJf - -C /opt/xbps | |
| - name: checkout void-packages | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: void-linux/void-packages | |
| ref: master | |
| - name: Merge this repository into void-linux/void-packages | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git remote add -f grvn https://github.com/grvn/void-packages.git | |
| git merge --no-commit --strategy-option=theirs --allow-unrelated-histories -Xignore-space-change grvn/main | |
| mkdir -p hostdir/binpkgs | |
| gh release download --pattern "*${ARCH}*" --dir hostdir/binpkgs --repo grvn/void-packages || true | |
| if [[ $ARCH == x86_64 ]]; then | |
| rm --force hostdir/binpkgs/*x86_64-musl* | |
| fi | |
| - name: Identify changes to build | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| latest_name=$(gh release view --json tagName --jq '.tagName' --repo grvn/void-packages || echo "Initial Commit") | |
| latest_sha=$(git rev-list --max-count=1 ${latest_name} 2>/dev/null || git rev-list --max-parents=0 grvn/main) | |
| echo "Latest Tag Name: ${latest_name}" | |
| echo "Latest Tag SHA: ${latest_sha}" | |
| git diff-tree -r --no-renames --name-only --diff-filter=AM ${latest_sha} ${SHA} -- 'srcpkgs/**' \ | |
| | cut -d/ -f 2 | uniq | xargs ./xbps-src sort-dependencies | tee /tmp/templates | |
| - name: setup binary bootstrap | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| ./xbps-src -m masterdir-${{ matrix.arch }} -A ${{ matrix.arch }} binary-bootstrap | |
| # -------------------- Packages to build -------------------- | |
| - name: build pkgs | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| pkgs=$(cat /tmp/templates) | |
| for pkg in ${pkgs}; do | |
| ./xbps-src pkg -j$(nproc) -m masterdir-${ARCH} "${pkg}" || printf "Failed building ${pkg}!\n" | |
| done | |
| # ----------------------------------------------------------- | |
| - name: Clean & sign | |
| working-directory: ${{ github.workspace }}/hostdir/binpkgs | |
| env: | |
| PRIVKEY: ${{ secrets.PRIV_KEY }} | |
| XBPS_PASSPHRASE: ${{ secrets.SIGN_PASS }} | |
| run: | | |
| xbps-rindex --remove-obsoletes ${PWD} | |
| printf "%s\n" "${PRIVKEY}" > key.pem | |
| xbps-rindex --privkey key.pem --sign --signedby "${REPO_NAME}-github-actions" ${PWD} | |
| xbps-rindex --privkey key.pem --sign-pkg ${PWD}/*.xbps | |
| rm -f key.pem | |
| xbps-rindex --clean ${PWD} | |
| - name: checksum | |
| working-directory: ${{ github.workspace }}/hostdir/binpkgs | |
| run: | | |
| rm -rf *.sha256sum *.sha512sum | |
| for file in *.xbps; do | |
| sha256sum "${file}" | cut -d ' ' -f 1 > "${file}.sha256sum" | |
| sha512sum "${file}" | cut -d ' ' -f 1 > "${file}.sha512sum" | |
| done | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}-repodata | |
| path: ${{ github.workspace }}/hostdir/binpkgs | |
| - name: short sha | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| printf "SHORT_SHA=$(git rev-parse --short ${SHA})" >> $GITHUB_ENV | |
| - name: release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| name: ${{ env.SHORT_SHA }} | |
| tag_name: ${{ env.TAG }} | |
| files: | | |
| ${{ github.workspace }}/hostdir/binpkgs/*.xbps | |
| ${{ github.workspace }}/hostdir/binpkgs/*.sha256sum | |
| ${{ github.workspace }}/hostdir/binpkgs/*.sha512sum | |
| ${{ github.workspace }}/hostdir/binpkgs/*.sig2 | |
| ${{ github.workspace }}/hostdir/binpkgs/*repodata |