diff --git a/action.yml b/action.yml index 03a75b3..02ce80b 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,10 @@ inputs: description: 'Enable debug output' required: false default: "false" + cache: + description: 'Enable caching of Twingate packages to speed up installation' + required: false + default: "true" runs: using: "composite" steps: @@ -21,14 +25,30 @@ 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" 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 + + - uses: awalsh128/cache-apt-pkgs-action@v1.6.0 + with: + packages: twingate + version: ${{ steps.twingate-version.outputs.version }} + debug: true + + # - name: Install Twingate (Linux) + # if: runner.os == 'Linux' + # shell: bash + # run: | + # sudo apt update + # 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 - name: Setup and start Twingate (Linux) if: runner.os == 'Linux'