From f4dd649ebad094ee266c0dab01f66c5381dcd3ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz?= Date: Wed, 27 Jan 2021 10:12:13 +0100 Subject: [PATCH 1/3] Add `channel` input --- action.yml | 4 ++++ index.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index da39586..fa077eb 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: true + 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}`); From db5eee9d766f70081715a642f465b49beeb4ed23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz?= Date: Wed, 27 Jan 2021 10:20:12 +0100 Subject: [PATCH 2/3] Add tests for `channel` input --- .github/workflows/test.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 }} From 1c4c409cb4613cd19e0d5ec13b076531e16e284d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz?= Date: Sat, 27 Feb 2021 10:27:11 +0100 Subject: [PATCH 3/3] Make `channel` optional Co-authored-by: Casper da Costa-Luis --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index fa077eb..5b48355 100644 --- a/action.yml +++ b/action.yml @@ -5,7 +5,7 @@ description: GitHub Action for setting up Snapcraft inputs: channel: description: The channel to install Snapcraft from - required: true + required: false default: stable snapcraft_token: description: Token for logging into Snapcraft