diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 5f95ce2..0e4facb 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -8,24 +8,34 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@main - - name: Prepare APT cache dir - run: | - mkdir -p "$RUNNER_TEMP/apt-cache"/{archives,lists} - - name: Cache apt packages + - name: Restore installed‑packages manifest + id: pkg_cache uses: actions/cache@main with: - path: | - ${{ runner.temp }}/apt-cache/archives - ${{ runner.temp }}/apt-cache/lists - key: ${{ runner.os }}-apt-${{ matrix.os }}-${{ hashFiles('**/airconnect/airconnect_installer') }} + path: installed_packages.txt + key: ${{ runner.os }}-installed-${{ matrix.os }} restore-keys: | - ${{ runner.os }}-apt-${{ matrix.os }}- - - name: Install dependencies + ${{ runner.os }}-installed-${{ matrix.os }}- + + - name: Re‑install previously installed packages + if: steps.pkg_cache.outputs.cache-hit == 'true' + run: | + sudo apt-get update + xargs -r sudo apt-get install -y < installed_packages.txt + + - name: Bootstrap & save installed‑package list + if: steps.pkg_cache.outputs.cache-hit != 'true' run: | - sudo apt-get update \ - -o Dir::Cache::Archives="$RUNNER_TEMP/apt-cache/archives" \ - -o Dir::Cache::Lists="$RUNNER_TEMP/apt-cache/lists" + sudo apt-get update sudo apt-get install -y zsh + dpkg-query --showformat='${Package}\n' --show > installed_packages.txt + + - name: Cache installed‑packages manifest + if: steps.pkg_cache.outputs.cache-hit != 'true' + uses: actions/cache@main + with: + path: installed_packages.txt + key: ${{ runner.os }}-installed-${{ matrix.os }} - name: Testing Shell script run: | @@ -34,23 +44,3 @@ jobs: sudo zsh airconnect_installer sudo zsh airconnect_uninstaller sudo zsh airconnect_uninstaller || true - - other-scripts: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@main - - name: Cache downloaded scripts - uses: actions/cache@main - with: - path: | - ${{ github.workspace }}/pihole-cloudflared - ${{ github.workspace }}/update_fastfetch - key: ${{ runner.os }}-scripts-${{ hashFiles('**/*.sh') }} - restore-keys: | - ${{ runner.os }}-scripts- - - - name: Run script 'pihole-cloudflared' - run: sudo bash pihole-cloudflared - - - name: Run script 'update_fastfetch' - run: sudo bash update_fastfetch