diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6ae4781..80fd683 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,6 +22,10 @@ jobs: - name: Snapcraft should be installed on macOS/Ubuntu if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') run: snapcraft --version + - name: Snapcraft should track the `stable` channel on Linux + if: startsWith(matrix.os, 'ubuntu') + shell: bash + run: snap info snapcraft | grep -q 'tracking:\s\+latest/stable' - name: Snapcraft should not be installed on Windows if: startsWith(matrix.os, 'windows') shell: bash @@ -46,6 +50,20 @@ jobs: - name: User should be logged in run: snapcraft whoami + # Install with channel + install-channel: + runs-on: ubuntu-latest + steps: + - name: Check out Git repository + uses: actions/checkout@v1 + - name: Run action + uses: ./ + with: + channel: candidate + - name: Snapcraft should track the `candidate` channel on Linux + shell: bash + run: snap info snapcraft | grep -q 'tracking:\s\+latest/candidate' + # Install with lxd lxd: runs-on: ${{ matrix.os }} diff --git a/action.yml b/action.yml index da39586..5b48355 100644 --- a/action.yml +++ b/action.yml @@ -3,6 +3,10 @@ author: Samuel Meuli description: GitHub Action for setting up Snapcraft inputs: + channel: + description: The channel to install Snapcraft from + required: false + default: stable snapcraft_token: description: Token for logging into Snapcraft required: true diff --git a/index.js b/index.js index 8663c6d..b8f5ab9 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,7 @@ const getPlatform = () => { */ const runLinuxInstaller = () => { const useLxd = process.env.INPUT_USE_LXD === "true"; - run("sudo snap install snapcraft --classic"); + run(`sudo snap install snapcraft --classic --channel ${process.env.INPUT_CHANNEL}`); if (useLxd) { run("sudo snap install lxd"); run(`sudo usermod --append --groups lxd ${process.env.USER}`);