Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/actions/setup-apt/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Setup Apt"
description: "Cache apt archives and install packages"
inputs:
archives-dir:
description: "Directory used for apt archives cache"
required: true
cache-key:
description: "Cache key for apt archives"
required: true
cache-restore-keys:
description: "Optional restore keys for apt archives cache"
required: false
default: ""
packages:
description: "Space-separated apt packages to install"
required: true
install-options:
description: "Additional apt-get install options"
required: false
default: "--no-install-recommends"
runs:
using: "composite"
steps:
- name: Prepare apt archives dir
run: |
mkdir -p "${{ inputs.archives-dir }}"
chmod -R a+rw "${{ inputs.archives-dir }}"
shell: bash

- name: Cache apt archives
uses: actions/cache@v4
with:
path: ${{ inputs.archives-dir }}
key: ${{ inputs.cache-key }}
restore-keys: ${{ inputs.cache-restore-keys }}

- name: Install apt packages
run: |
sudo apt-get update
sudo apt-get install -y ${{ inputs.install-options }} -o dir::cache::archives="${{ inputs.archives-dir }}" ${{ inputs.packages }}
shell: bash

- name: Restore apt archives permissions
if: ${{ always() }}
run: |
sudo chmod -R a+rw "${{ inputs.archives-dir }}"
shell: bash
33 changes: 13 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,15 @@ jobs:

- uses: ./.github/actions/setup-bun

- name: Cache apt packages
- name: Setup apt dependencies
if: contains(matrix.settings.host, 'ubuntu')
uses: actions/cache@v4
uses: ./.github/actions/setup-apt
with:
path: ~/apt-cache
key: ${{ runner.os }}-${{ matrix.settings.target }}-apt-${{ hashFiles('.github/workflows/publish.yml') }}
restore-keys: |
archives-dir: ${{ runner.temp }}/apt-cache
cache-key: ${{ runner.os }}-${{ matrix.settings.target }}-apt-${{ hashFiles('.github/workflows/publish.yml', '.github/actions/setup-apt/action.yml') }}
cache-restore-keys: |
${{ runner.os }}-${{ matrix.settings.target }}-apt-

- name: install dependencies (ubuntu only)
if: contains(matrix.settings.host, 'ubuntu')
run: |
mkdir -p ~/apt-cache && chmod -R a+rw ~/apt-cache
sudo apt-get update
sudo apt-get install -y --no-install-recommends -o dir::cache::archives="$HOME/apt-cache" libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
sudo chmod -R a+rw ~/apt-cache
packages: libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf

- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -255,18 +248,18 @@ jobs:
name: opencode-cli
path: packages/opencode/dist

- name: Cache apt packages (AUR)
uses: actions/cache@v4
- name: Setup apt dependencies (AUR)
uses: ./.github/actions/setup-apt
with:
path: /var/cache/apt/archives
key: ${{ runner.os }}-apt-aur-${{ hashFiles('.github/workflows/publish.yml') }}
restore-keys: |
archives-dir: ${{ runner.temp }}/apt-cache
cache-key: ${{ runner.os }}-apt-aur-${{ hashFiles('.github/workflows/publish.yml', '.github/actions/setup-apt/action.yml') }}
cache-restore-keys: |
${{ runner.os }}-apt-aur-
# makepkg is a recommended dep of pacman-package-manager, not included with --no-install-recommends
packages: pacman-package-manager makepkg

- name: Setup SSH for AUR
run: |
sudo apt-get update
sudo apt-get install -y pacman-package-manager
mkdir -p ~/.ssh
echo "${{ secrets.AUR_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
Expand Down