Skip to content

Commit

Permalink
Merge pull request #27 from Saviq/add-channel
Browse files Browse the repository at this point in the history
Add `channel` input
  • Loading branch information
casperdcl authored Feb 28, 2021
2 parents e63c2a9 + 1c4c409 commit 10d7d0a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down

0 comments on commit 10d7d0a

Please sign in to comment.