Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/snap-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ jobs:
echo "SNAPCRAFT_STORE_CREDENTIALS not configured, skipping Snap Store upload."
exit 0
fi
mkdir -p "$HOME/.snapcraft"
printf "%s" "$SNAPCRAFT_STORE_CREDENTIALS" | base64 -d > "$HOME/.snapcraft/snapcraft.cfg"

# Snapcraft 7+ reads Ubuntu One credentials from SNAPCRAFT_STORE_CREDENTIALS
# (output of `snapcraft export-login`). Do not write ~/.snapcraft/snapcraft.cfg.
#
# Support secrets stored either as raw export-login text or base64 of that text.
CREDS="$SNAPCRAFT_STORE_CREDENTIALS"
if [[ "$CREDS" != \{* ]]; then
if DECODED=$(printf '%s' "$CREDS" | base64 -d 2>/dev/null) && [[ "$DECODED" == \{* ]]; then
CREDS="$DECODED"
fi
fi
export SNAPCRAFT_STORE_CREDENTIALS="$CREDS"

snapcraft upload --release=stable "${{ steps.snap_file.outputs.file }}"
2 changes: 1 addition & 1 deletion DISTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ sudo snap install snapcraft --classic
snapcraft

# Install
sudo snap install ipb_0.8.3_amd64.snap --dangerous
sudo snap install investec-ipb_0.8.3_amd64.snap --dangerous
```

See `snap/snapcraft.yaml` for configuration.
Expand Down
38 changes: 19 additions & 19 deletions UBUNTU_DISTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,21 @@ npm run pkg:linux
# Build snap
snapcraft

# Result: ipb_0.8.3_amd64.snap
# Result: investec-ipb_0.9.3_amd64.snap
```

### Installing Snap

```bash
sudo snap install ipb_0.8.3_amd64.snap --dangerous
sudo snap install investec-ipb_0.9.3_amd64.snap --dangerous
```

### Publishing to Snap Store

1. Register at [Snap Store](https://snapcraft.io)
2. Upload snap: `snapcraft upload --release=stable ipb_0.8.3_amd64.snap`
3. Users install: `sudo snap install ipb`
2. Register the snap name (once): `snapcraft register investec-ipb`
3. Upload snap: `snapcraft upload --release=stable investec-ipb_0.9.3_amd64.snap`
4. Users install: `sudo snap install investec-ipb`

### GitHub Actions: Automatic Snap Store Publish

Expand All @@ -189,29 +190,28 @@ when `SNAPCRAFT_STORE_CREDENTIALS` is configured.
2. Export CI credentials (replace values as needed):

```bash
snapcraft export-login --snaps ipb --channels stable snapcraft-login.txt
snapcraft export-login \
--snaps investec-ipb \
--acls package_access,package_push,package_update,package_release \
--channels stable \
snapcraft-login.txt
```

3. Base64-encode the file (single line output):
3. In GitHub, add a repository secret:
- Name: `SNAPCRAFT_STORE_CREDENTIALS`
- Value: the **raw contents** of `snapcraft-login.txt` (not a password; not written to `snapcraft.cfg`)

```bash
base64 -w 0 snapcraft-login.txt
```
Base64-encoding the file is optional; the workflow accepts either raw or base64-encoded
export-login output.

On macOS, use:

```bash
base64 -i snapcraft-login.txt | tr -d '\n'
```

4. In GitHub, add a repository secret:
- Name: `SNAPCRAFT_STORE_CREDENTIALS`
- Value: the base64 output from step 3
5. Push a release tag (for example `v0.8.4`) to trigger automatic build + publish.
4. Push a release tag (for example `v0.9.3`) to trigger automatic build + publish.

If the secret is not set, the workflow still builds the `.snap` file and uploads it to
the GitHub Release, but skips Snap Store publishing.

Snapcraft 7+ authenticates only via `SNAPCRAFT_STORE_CREDENTIALS` (or interactive login).
Do not use `snapcraft login --with` in CI.

## Method 4: AppImage

AppImage is a portable format that doesn't require installation.
Expand Down
3 changes: 2 additions & 1 deletion scripts/create-snap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ snapcraft pack --destructive-mode
echo ""
echo "Snap build complete."
echo "Install locally with:"
echo " sudo snap install ipb_${VERSION}_amd64.snap --dangerous"
echo " sudo snap install investec-ipb_${VERSION}_amd64.snap --dangerous"
echo "Then run: investec-ipb --version"
14 changes: 7 additions & 7 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ipb
name: investec-ipb
version: '0.9.3'
summary: CLI application to manage Investec Programmable Banking cards
description: |
Expand All @@ -7,18 +7,18 @@ description: |
transaction management, and account operations.

Features:
- Deploy JavaScript code to programmable cards
- Local code emulation and testing
- Transaction log retrieval
- Account and balance management
- Environment variable management
- Deploy JavaScript code to programmable cards
- Local code emulation and testing
- Transaction log retrieval
- Account and balance management
- Environment variable management

grade: stable
confinement: strict
base: core24

apps:
ipb:
investec-ipb:
command: usr/bin/ipb
plugs:
- network
Expand Down