Skip to content

Commit

Permalink
fix: correctly place LP credentials for snapcraft>=8.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsgruk committed May 1, 2024
1 parent 00b6f68 commit 3c58296
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions release-to-candidate/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,32 @@ runs:
with:
token: ${{ inputs.repo-token }}

- name: Setup semver tool
shell: bash
run: |
wget -q https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver
sudo mv semver /usr/bin/semver
chmod +x /usr/bin/semver
- name: Setup snapcraft
shell: bash
run: |
sudo snap install snapcraft --channel "${{inputs.snapcraft-channel}}" --classic
# Setup Launchpad credentials
mkdir -p ~/.local/share/snapcraft/provider/launchpad
echo "${{ inputs.launchpad-token }}" > ~/.local/share/snapcraft/provider/launchpad/credentials
installed_version="$(snapcraft version | cut -d" " -f2)"
# Setup Launchpad credentials.
# For versions of snapcraft after 8.2.0, the path is different for the launchpad
# credentials.
if [[ "$(semver compare "8.2.0" "$installed_version")" == "1" ]]; then
# If the installed version is *lower* than 8.2.0
mkdir -p ~/.local/share/snapcraft/provider/launchpad
echo "${{ inputs.launchpad-token }}" > ~/.local/share/snapcraft/provider/launchpad/credentials
else
mkdir -p ~/.local/share/snapcraft
echo "${{ inputs.launchpad-token }}" > ~/.local/share/snapcraft/launchpad-credentials
fi
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
Expand Down

0 comments on commit 3c58296

Please sign in to comment.