BUILD #1501
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 | |
| permissions: | |
| contents: write | |
| actions: write | |
| concurrency: | |
| group: build-packages | |
| cancel-in-progress: false | |
| on: | |
| push: | |
| schedule: | |
| - cron: '35 0,12 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| rebuild-packages: | |
| description: 'Packages to rebuild ignoring cache (comma-separated, leave empty for normal build)' | |
| required: false | |
| default: '' | |
| jobs: | |
| buildAUR: | |
| strategy: | |
| matrix: | |
| repos: [ttf-sarasa-gothic-nerd-fonts, glfw-wayland-minecraft-cursorfix, kwin-effect-rounded-corners-git, code-translucent, vicinae, waywallen, waywallen-display, plasma-wallpaper-waywallen, open-wallpaper-engine, plasma6-wallpapers-wallpaper-engine-git,libadwaita-without-adwaita, manboster] | |
| fail-fast: false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get latest version from AUR | |
| id: aur-version | |
| env: | |
| PKG_NAME: ${{ matrix.repos }} | |
| run: | | |
| bash scripts/check-aur-version.sh | |
| # use cache to speed up build | |
| - name: restore from cache | |
| id: cache | |
| if: | | |
| github.event_name != 'workflow_dispatch' || | |
| !contains(format(',{0},', github.event.inputs.rebuild-packages), format(',{0},', matrix.repos)) | |
| uses: actions/cache@v4 | |
| with: | |
| key: aur-build-cache-${{ matrix.repos }}-${{ steps.aur-version.outputs.latest_version }} | |
| path: './*/${{ matrix.repos }}-*.pkg.tar.zst' | |
| - uses: ./actions/build-aur | |
| if: | | |
| steps.cache.outputs.cache-hit != 'true' || | |
| (github.event_name == 'workflow_dispatch' && | |
| contains(format(',{0},', github.event.inputs.rebuild-packages), format(',{0},', matrix.repos))) | |
| with: | |
| repo-name: ${{ matrix.repos }} | |
| preinstallPkgs: ${{ matrix.preinstall-pkgs }} | |
| - name: package tarball | |
| run: tar -czf '${{ matrix.repos }}.tar.gz' ./*/${{ matrix.repos }}-*.pkg.tar.zst | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| path: ./${{ matrix.repos }}.tar.gz | |
| name: ${{ matrix.repos }} | |
| if-no-files-found: error | |
| - name: Delete cached package before rebuild | |
| if: | | |
| github.event_name == 'workflow_dispatch' && | |
| contains(format(',{0},', github.event.inputs.rebuild-packages), format(',{0},', matrix.repos)) | |
| env: | |
| CACHE_KEY: aur-build-cache-${{ matrix.repos }}-${{ steps.aur-version.outputs.latest_version }} | |
| run: | | |
| curl -sSf -G -X DELETE \ | |
| -H "Authorization: Bearer ${{ github.token }}" \ | |
| --data-urlencode "key=$CACHE_KEY" \ | |
| --data-urlencode "ref=refs/heads/${{ github.ref_name }}" \ | |
| "$GITHUB_API_URL/repos/${{ github.repository }}/actions/caches" \ | |
| || echo "No cache entry to delete" | |
| - uses: actions/cache/save@v4 | |
| if: | | |
| github.event_name == 'workflow_dispatch' && | |
| contains(format(',{0},', github.event.inputs.rebuild-packages), format(',{0},', matrix.repos)) && | |
| success() | |
| with: | |
| key: aur-build-cache-${{ matrix.repos }}-${{ steps.aur-version.outputs.latest_version }} | |
| path: './*/${{ matrix.repos }}-*.pkg.tar.zst' | |
| - uses: ncipollo/release-action@v1 | |
| if: | | |
| steps.cache.outputs.cache-hit != 'true' || | |
| (github.event_name == 'workflow_dispatch' && | |
| contains(format(',{0},', github.event.inputs.rebuild-packages), format(',{0},', matrix.repos))) | |
| with: | |
| allowUpdates: true | |
| tag: "packages" | |
| artifacts: "./*/${{ matrix.repos }}-*.zst" | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| buildNonAUR: | |
| strategy: | |
| matrix: | |
| PKGBUILDs: ['gb-cli-git'] | |
| fail-fast: false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Extract version from PKGBUILD | |
| id: version | |
| run: | | |
| source "./${{ matrix.PKGBUILDs }}/PKGBUILD" | |
| # 尝试修复GitHub Actions无法正确处理冒号带来的问题 | |
| pkgver=$(echo "$pkgver" | sed 's/:/*/g') | |
| echo "pkgver=${pkgver}" >> $GITHUB_OUTPUT | |
| echo "pkgname=${pkgname}" >> $GITHUB_OUTPUT | |
| - name: restore from cache | |
| id: cache | |
| if: | | |
| github.event_name != 'workflow_dispatch' || | |
| !contains(format(',{0},', github.event.inputs.rebuild-packages), format(',{0},', matrix.PKGBUILDs)) | |
| uses: actions/cache@v4 | |
| with: | |
| key: aur-build-cache-${{ matrix.PKGBUILDs }}-${{ steps.version.outputs.pkgver }} | |
| path: './*/${{ matrix.PKGBUILDs }}-*.pkg.tar.zst' | |
| - name: Free Disk Space (Ubuntu) | |
| if: steps.cache.outputs.cache-hit != 'true' && matrix.PKGBUILDs == '64gram-desktop' | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| # this might remove tools that are actually needed, | |
| # if set to "true" but frees about 6 GB | |
| tool-cache: true | |
| # all of these default to true, but feel free to set to | |
| # "false" if necessary for your workflow | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: false | |
| swap-storage: false | |
| #- name: Convert LF to CRLF using unix2dos | |
| # run: | | |
| # sudo apt-get update && sudo apt-get install -y dos2unix | |
| # unix2dos ./64gram-desktop/fix-lzma-link.patch | |
| # unix2dos ./64gram-desktop/block-sponsored_messages.patch | |
| - name: Build Non-AUR packages | |
| if: | | |
| steps.cache.outputs.cache-hit != 'true' || | |
| (github.event_name == 'workflow_dispatch' && | |
| contains(format(',{0},', github.event.inputs.rebuild-packages), format(',{0},', matrix.PKGBUILDs))) | |
| id: makepkg | |
| uses: ./actions/build-nonaur | |
| with: | |
| pkgdir: ${{ matrix.PKGBUILDs }} | |
| aurDeps: true | |
| - name: package tarball | |
| run: tar -czf '${{ matrix.PKGBUILDs }}.tar.gz' ./*/${{ matrix.PKGBUILDs }}-*.pkg.tar.zst | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| path: ./*/${{ matrix.PKGBUILDs }}-*.pkg.tar.zst | |
| name: ${{ matrix.PKGBUILDs }} | |
| if-no-files-found: error | |
| - name: Delete cached package before rebuild | |
| if: | | |
| github.event_name == 'workflow_dispatch' && | |
| contains(format(',{0},', github.event.inputs.rebuild-packages), format(',{0},', matrix.PKGBUILDs)) | |
| env: | |
| CACHE_KEY: aur-build-cache-${{ matrix.PKGBUILDs }}-${{ steps.version.outputs.pkgver }} | |
| run: | | |
| curl -sSf -G -X DELETE \ | |
| -H "Authorization: Bearer ${{ github.token }}" \ | |
| --data-urlencode "key=$CACHE_KEY" \ | |
| --data-urlencode "ref=refs/heads/${{ github.ref_name }}" \ | |
| "$GITHUB_API_URL/repos/${{ github.repository }}/actions/caches" \ | |
| || echo "No cache entry to delete" | |
| - uses: actions/cache/save@v4 | |
| if: | | |
| github.event_name == 'workflow_dispatch' && | |
| contains(format(',{0},', github.event.inputs.rebuild-packages), format(',{0},', matrix.PKGBUILDs)) && | |
| success() | |
| with: | |
| key: aur-build-cache-${{ matrix.PKGBUILDs }}-${{ steps.version.outputs.pkgver }} | |
| path: './*/${{ matrix.PKGBUILDs }}-*.pkg.tar.zst' | |
| - uses: ncipollo/release-action@v1 | |
| if: | | |
| steps.cache.outputs.cache-hit != 'true' || | |
| (github.event_name == 'workflow_dispatch' && | |
| contains(format(',{0},', github.event.inputs.rebuild-packages), format(',{0},', matrix.PKGBUILDs))) | |
| with: | |
| allowUpdates: true | |
| tag: "packages" | |
| artifacts: "./*/${{ matrix.PKGBUILDs }}-*.pkg.tar.zst" | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| uploadDatabase: | |
| runs-on: ubuntu-latest | |
| if: always() | |
| needs: [buildAUR , buildNonAUR] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| id: download | |
| - name: Display structure of downloaded files | |
| run: ls -R ${{ steps.download.outputs.download-path }} | |
| - name: decompress tarballs | |
| run: | | |
| find . -name "*.tar.gz" -type f | while read file; do | |
| echo "Extracting: $file" | |
| tar -xzf "$file" -C "$(dirname "$file")" | |
| done | |
| - name: Deduplicate package files | |
| run: | | |
| mkdir -p ./unique_packages | |
| find . -name "*.pkg.tar.zst" -type f -print0 | sort -z | while IFS= read -r -d '' file; do | |
| name="$(basename "$file")" | |
| if [ -f "./unique_packages/$name" ]; then | |
| echo "::warning::Duplicate package file skipped: $file" | |
| else | |
| cp "$file" "./unique_packages/$name" | |
| fi | |
| done | |
| ls -l ./unique_packages | |
| - name: Download previous database | |
| run: | | |
| mkdir -p ./previous_db | |
| if ! curl -fsSL -o ./previous_db/gb-cha0s.db.tar.gz \ | |
| "https://github.com/${{ github.repository }}/releases/download/packages/gb-cha0s.db.tar.gz"; then | |
| echo "No previous database found, starting from scratch" | |
| rm -f ./previous_db/gb-cha0s.db.tar.gz | |
| fi | |
| - uses: ./actions/create-db | |
| with: | |
| repo_name: gb-cha0s | |
| gpg-privatekey: ${{ secrets.gpg_private_key }} | |
| package_path: './unique_packages' | |
| existing_db: './previous_db/gb-cha0s.db.tar.gz' | |
| output_path: './upload_packages' | |
| - uses: ncipollo/release-action@v1 | |
| with: | |
| allowUpdates: true | |
| tag: "packages" | |
| artifacts: "./upload_packages/*.sig,./upload_packages/*.files,./upload_packages/*.db,./upload_packages/*.tar.gz" | |
| token: ${{ secrets.GITHUB_TOKEN }} |