-
Notifications
You must be signed in to change notification settings - Fork 14
feat(action.yml): add caching option for Twingate .deb packages to speed up installation process #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(action.yml): add caching option for Twingate .deb packages to speed up installation process #56
Changes from all commits
0fe93f5
5b3151a
a3b96b1
9d5d444
c3d1b05
ab74c55
12d349e
c123f3e
bc2e5ab
35a3dda
3063c9f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,10 @@ inputs: | |||||||||||||||
| description: 'Enable debug output' | ||||||||||||||||
| required: false | ||||||||||||||||
| default: "false" | ||||||||||||||||
| cache: | ||||||||||||||||
| description: 'Enable caching of Twingate .deb packages to speed up installation' | ||||||||||||||||
| required: false | ||||||||||||||||
| default: "true" | ||||||||||||||||
| runs: | ||||||||||||||||
| using: "composite" | ||||||||||||||||
| steps: | ||||||||||||||||
|
|
@@ -21,14 +25,41 @@ runs: | |||||||||||||||
| echo "Unsupported Runner OS: ${{ runner.os }}" | ||||||||||||||||
| exit 1 | ||||||||||||||||
|
|
||||||||||||||||
| - name: Install Twingate (Linux) | ||||||||||||||||
| if: runner.os == 'Linux' | ||||||||||||||||
| - name: Get latest Twingate version | ||||||||||||||||
| if: runner.os == 'Linux' && inputs.cache == 'true' | ||||||||||||||||
| id: twingate-version | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: | | ||||||||||||||||
| sudo apt update | ||||||||||||||||
| VERSION=$(curl -s https://packages.twingate.com/apt/Packages | awk '/^Version:/ {print $2}' | sort -V | tail -1) | ||||||||||||||||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||||||||||||||||
| echo "Latest Twingate version: $VERSION" | ||||||||||||||||
|
|
||||||||||||||||
| - name: Cache Twingate package | ||||||||||||||||
| if: runner.os == 'Linux' && inputs.cache == 'true' | ||||||||||||||||
| uses: actions/cache@v5 | ||||||||||||||||
| id: cache-twingate | ||||||||||||||||
| with: | ||||||||||||||||
| path: /tmp/twingate-cache | ||||||||||||||||
| key: twingate-deb-${{ runner.os }}-${{ runner.arch }}-${{ steps.twingate-version.outputs.version }} | ||||||||||||||||
|
|
||||||||||||||||
| - name: Download Twingate package (Linux) | ||||||||||||||||
| if: runner.os == 'Linux' && steps.cache-twingate.outputs.cache-hit != 'true' | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: | | ||||||||||||||||
| echo "No cache - creating cache folder" | ||||||||||||||||
| mkdir -p /tmp/twingate-cache | ||||||||||||||||
| echo "deb [trusted=yes] https://packages.twingate.com/apt/ /" | sudo tee /etc/apt/sources.list.d/twingate.list | ||||||||||||||||
| sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/twingate.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" | ||||||||||||||||
| sudo apt install -yq twingate | ||||||||||||||||
| cd /tmp/twingate-cache | ||||||||||||||||
| apt-get download twingate | ||||||||||||||||
|
|
||||||||||||||||
| - name: Install Twingate from cache (Linux) | ||||||||||||||||
| if: runner.os == 'Linux' && inputs.cache == 'true' | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: | | ||||||||||||||||
| echo "Installing Twingate from cache" | ||||||||||||||||
| sudo dpkg -i /tmp/twingate-cache/twingate*.deb || true | ||||||||||||||||
|
||||||||||||||||
| sudo dpkg -i /tmp/twingate-cache/twingate*.deb || true | |
| set -e | |
| if ! ls /tmp/twingate-cache/twingate*.deb >/dev/null 2>&1; then | |
| echo "Error: No Twingate .deb package found in /tmp/twingate-cache" >&2 | |
| exit 1 | |
| fi | |
| sudo dpkg -i /tmp/twingate-cache/twingate*.deb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'apt-get download' command is missing 'sudo' prefix. Without elevated privileges, this command will fail to download the package. This should be 'sudo apt-get download twingate' to match the pattern used elsewhere in the action.