Skip to content
Open
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
7 changes: 6 additions & 1 deletion .github/actions/package/appimage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ description: >-
`out`.

inputs:
slug:
description: The application's slug (`scripts/names.mjs`), which names its binary and its files.
required: true
private-key:
description: The minisign key that signs the package.
required: true
Expand Down Expand Up @@ -43,10 +46,12 @@ runs:

- name: It holds the application alone
shell: bash
env:
SLUG: ${{ inputs.slug }}
run: |
binaries=$(ls target/packages/appimage/squashfs-root/usr/bin)
echo "$binaries"
test "$binaries" = devnotes
test "$binaries" = "$SLUG"

- name: It carries the icon
shell: bash
Expand Down
20 changes: 14 additions & 6 deletions .github/actions/package/deb/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: >-
its icon, its licence and this version's notes, no GTK. Gathered with its signature into `out`.

inputs:
slug:
description: The application's slug (`scripts/names.mjs`), which names its binary and its files.
required: true
version:
description: The version the package carries.
required: true
Expand All @@ -29,27 +32,32 @@ runs:

- name: It holds the application alone
shell: bash
env:
SLUG: ${{ inputs.slug }}
run: |
binaries=$(dpkg-deb -c target/packages/deb/*.deb | awk '$6 ~ /^usr\/bin\/./ { print $6 }')
echo "$binaries"
test "$binaries" = usr/bin/devnotes
test "$binaries" = "usr/bin/$SLUG"

- name: It carries the icon
shell: bash
env:
SLUG: ${{ inputs.slug }}
run: |
files=$(dpkg-deb -c target/packages/deb/*.deb | awk '{ print $6 }')
grep -qx usr/share/icons/hicolor/512x512/apps/devnotes.png <<< "$files"
entry=$(dpkg-deb --fsys-tarfile target/packages/deb/*.deb | tar -xO usr/share/applications/devnotes.desktop)
grep -qx Icon=devnotes <<< "$entry"
grep -qx "usr/share/icons/hicolor/512x512/apps/$SLUG.png" <<< "$files"
entry=$(dpkg-deb --fsys-tarfile target/packages/deb/*.deb | tar -xO "usr/share/applications/$SLUG.desktop")
grep -qx "Icon=$SLUG" <<< "$entry"

- name: It carries the licence and this version's notes
shell: bash
env:
VERSION: ${{ inputs.version }}
SLUG: ${{ inputs.slug }}
run: |
files=$(dpkg-deb -c target/packages/deb/*.deb | awk '{ print $6 }')
grep -qx usr/share/doc/devnotes/copyright <<< "$files"
shipped=$(dpkg-deb --fsys-tarfile target/packages/deb/*.deb | tar -xO usr/share/doc/devnotes/changelog.gz | gunzip)
grep -qx "usr/share/doc/$SLUG/copyright" <<< "$files"
shipped=$(dpkg-deb --fsys-tarfile target/packages/deb/*.deb | tar -xO "usr/share/doc/$SLUG/changelog.gz" | gunzip)
test "$shipped" = "$(node scripts/release-notes.mjs extract --version "$VERSION")"

- name: It depends on no GTK
Expand Down
32 changes: 24 additions & 8 deletions .github/actions/package/dmg/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ description: >-
into `out`.

inputs:
name:
description: The application's display name (`scripts/names.mjs`), which names the bundle.
required: true
slug:
description: The application's slug (`scripts/names.mjs`), which names its binary and its files.
required: true
version:
description: The version the packages carry.
required: true
Expand All @@ -26,11 +32,12 @@ runs:
env:
CARGO_PACKAGER_SIGN_PRIVATE_KEY: ${{ inputs.private-key }}
CARGO_PACKAGER_SIGN_PRIVATE_KEY_PASSWORD: ${{ inputs.password }}
NAME: ${{ inputs.name }}
run: |
for attempt in 1 2 3; do
cargo packager -p app --release -f app,dmg -o "$GITHUB_WORKSPACE/target/packages/dmg" && exit 0
echo "attempt $attempt failed"
hdiutil detach /Volumes/DevNotes -force > /dev/null 2>&1 || true
hdiutil detach "/Volumes/$NAME" -force > /dev/null 2>&1 || true
rm -rf target/packages/dmg
sleep 15
done
Expand All @@ -41,36 +48,45 @@ runs:
working-directory: target/packages/dmg
env:
VERSION: ${{ inputs.version }}
NAME: ${{ inputs.name }}
SLUG: ${{ inputs.slug }}
run: |
arch=$([ "$RUNNER_ARCH" = ARM64 ] && echo aarch64 || echo x64)
for ending in dmg dmg.sig; do
mv "DevNotes_${VERSION}_$arch.$ending" "devnotes_${VERSION}_$arch.$ending"
mv "${NAME}_${VERSION}_$arch.$ending" "${SLUG}_${VERSION}_$arch.$ending"
done
for ending in app.tar.gz app.tar.gz.sig; do
mv "DevNotes.$ending" "devnotes_${VERSION}_$arch.$ending"
mv "$NAME.$ending" "${SLUG}_${VERSION}_$arch.$ending"
done

- name: It is signed ad hoc
shell: bash
run: codesign --verify --deep --strict target/packages/dmg/DevNotes.app
env:
NAME: ${{ inputs.name }}
run: codesign --verify --deep --strict "target/packages/dmg/$NAME.app"

- name: It holds the application alone
shell: bash
env:
NAME: ${{ inputs.name }}
SLUG: ${{ inputs.slug }}
run: |
archived=$(tar -tzf target/packages/dmg/*.app.tar.gz | grep '/Contents/MacOS/.' | xargs -n1 basename)
echo "archive: $archived"
test "$archived" = devnotes
test "$archived" = "$SLUG"
mounted="$RUNNER_TEMP/image"
{ yes 2> /dev/null || true; } | PAGER='cat' hdiutil attach -nobrowse -readonly -mountpoint "$mounted" target/packages/dmg/*.dmg > /dev/null
imaged=$(ls "$mounted/DevNotes.app/Contents/MacOS")
imaged=$(ls "$mounted/$NAME.app/Contents/MacOS")
hdiutil detach "$mounted" > /dev/null
echo "image: $imaged"
test "$imaged" = devnotes
test "$imaged" = "$SLUG"

- name: It carries the icon
shell: bash
env:
NAME: ${{ inputs.name }}
run: |
app=target/packages/dmg/DevNotes.app/Contents
app="target/packages/dmg/$NAME.app/Contents"
icon=$(plutil -extract CFBundleIconFile raw "$app/Info.plist")
test -e "$app/Resources/$icon"
grep -q "/Contents/Resources/$icon$" <<< "$(tar -tzf target/packages/dmg/*.app.tar.gz)"
Expand Down
7 changes: 6 additions & 1 deletion .github/actions/package/nsis/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: >-
install the application alone. Gathered with its signature into `out`.

inputs:
slug:
description: The application's slug (`scripts/names.mjs`), which names its binary and its files.
required: true
private-key:
description: The minisign key that signs the installer.
required: true
Expand All @@ -26,13 +29,15 @@ runs:

- name: It installs the application alone
shell: bash
env:
SLUG: ${{ inputs.slug }}
run: |
installer=$(cygpath -w target/packages/nsis/*-setup.exe)
folder=$(cygpath -w "$RUNNER_TEMP/installed")
pwsh -NoProfile -Command "Start-Process '$installer' -ArgumentList '/S','/D=$folder' -Wait"
executables=$(find "$RUNNER_TEMP/installed" -maxdepth 1 -name '*.exe' -printf '%f\n' | sort | xargs)
echo "$executables"
test "$executables" = 'devnotes.exe uninstall.exe'
test "$executables" = "$SLUG.exe uninstall.exe"

- name: Gather
shell: bash
Expand Down
22 changes: 16 additions & 6 deletions .github/actions/package/rpm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: >-
icon, its licence and this version's notes. Gathered with its signature into `out`.

inputs:
slug:
description: The application's slug (`scripts/names.mjs`), which names its binary and its files.
required: true
version:
description: The version the package carries.
required: true
Expand All @@ -30,7 +33,8 @@ runs:
shell: bash
env:
VERSION: ${{ inputs.version }}
run: cargo generate-rpm -p crates/app -o "target/packages/rpm/devnotes-$VERSION.x86_64.rpm"
SLUG: ${{ inputs.slug }}
run: cargo generate-rpm -p crates/app -o "target/packages/rpm/$SLUG-$VERSION.x86_64.rpm"

- name: Sign
shell: bash
Expand All @@ -41,23 +45,29 @@ runs:

- name: It holds the application alone
shell: bash
env:
SLUG: ${{ inputs.slug }}
run: |
binaries=$(rpm -qlp target/packages/rpm/*.rpm | grep '^/usr/bin/')
echo "$binaries"
test "$binaries" = /usr/bin/devnotes
test "$binaries" = "/usr/bin/$SLUG"

- name: It carries the icon
shell: bash
env:
SLUG: ${{ inputs.slug }}
run: |
files=$(rpm -qlp target/packages/rpm/*.rpm)
grep -qx /usr/share/icons/hicolor/512x512/apps/devnotes.png <<< "$files"
grep -qx /usr/share/applications/devnotes.desktop <<< "$files"
grep -qx "/usr/share/icons/hicolor/512x512/apps/$SLUG.png" <<< "$files"
grep -qx "/usr/share/applications/$SLUG.desktop" <<< "$files"

- name: It carries the licence and this version's notes
shell: bash
env:
SLUG: ${{ inputs.slug }}
run: |
grep -qx /usr/share/licenses/devnotes/LICENSE <<< "$(rpm -qlp target/packages/rpm/*.rpm)"
grep -qx /usr/share/doc/devnotes/changelog.gz <<< "$(rpm -qdp target/packages/rpm/*.rpm)"
grep -qx "/usr/share/licenses/$SLUG/LICENSE" <<< "$(rpm -qlp target/packages/rpm/*.rpm)"
grep -qx "/usr/share/doc/$SLUG/changelog.gz" <<< "$(rpm -qdp target/packages/rpm/*.rpm)"

- name: Gather
shell: bash
Expand Down
16 changes: 9 additions & 7 deletions .github/scripts/close-and-quit.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/env bash
# Each command given launches DevNotes as a person would, under the X server and the session bus
# the caller opened: its window opens, its close button hides it and leaves the process running
# (« Close to tray » is on by default, tray icon or not), `--action quit` from a second launch ends
# it with 0, and its terminal shows nothing but Xvfb's own pair about DRI3.
# Each command given launches the application as a person would, under the X server and the
# session bus the caller opened: its window opens, its close button hides it and leaves the process
# running (« Close to tray » is on by default, tray icon or not), `--action quit` from a second
# launch ends it with 0, and its terminal shows nothing but Xvfb's own pair about DRI3. The window
# is found by the application's name (`scripts/names.mjs`).
set -euo pipefail
name=$(node scripts/names.mjs display-name)

openbox > /dev/null 2>&1 &

Expand All @@ -23,9 +25,9 @@ for launch in "$@"; do
echo "== $launch"
$launch --profile "$profile" > /dev/null 2> "$terminal" &
pid=$!
until_true "wmctrl -l 2> /dev/null | grep -q DevNotes" "$launch opened no window"
wmctrl -c DevNotes
until_true "! wmctrl -l 2> /dev/null | grep -q DevNotes" "$launch kept its window after the close button"
until_true "wmctrl -l 2> /dev/null | grep -qF '$name'" "$launch opened no window"
wmctrl -c "$name"
until_true "! wmctrl -l 2> /dev/null | grep -qF '$name'" "$launch kept its window after the close button"
if ! kill -0 "$pid" 2> /dev/null; then
echo "::error::$launch ended at the close button"
exit 1
Expand Down
12 changes: 7 additions & 5 deletions .github/scripts/installed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
# two minutes at most.
set -euo pipefail
expected=$1
name=$(node scripts/names.mjs display-name)
slug=$(node scripts/names.mjs slug)
case "$expected" in
1.0.0) packages=old ;;
1.0.1) packages=new ;;
*) echo "::error::no packages for $expected"; exit 2 ;;
esac

if [ "$RUNNER_OS" = Linux ]; then
installed="$RUNNER_TEMP/installed/DevNotes.AppImage"
installed="$RUNNER_TEMP/installed/$name.AppImage"
want=$(sha256sum "$packages"/*.AppImage | cut -d' ' -f1)
have=$(sha256sum "$installed" | cut -d' ' -f1)
if [ "$want" != "$have" ] || [ ! -x "$installed" ]; then
Expand All @@ -24,9 +26,9 @@ if [ "$RUNNER_OS" = Linux ]; then
fi

if [ "$RUNNER_OS" = macOS ]; then
app="$RUNNER_TEMP/installed/DevNotes.app"
app="$RUNNER_TEMP/installed/$name.app"
found=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$app/Contents/Info.plist")
if [ "$found" != "$expected" ] || [ ! -x "$app/Contents/MacOS/devnotes" ]; then
if [ "$found" != "$expected" ] || [ ! -x "$app/Contents/MacOS/$slug" ]; then
echo "::error::the application in place is '$found', expected $expected"
exit 1
fi
Expand All @@ -36,12 +38,12 @@ fi

# The uninstall entry the NSIS installer writes under HKCU, a field of it.
entry() {
pwsh -NoProfile -Command "(Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' -ErrorAction SilentlyContinue | Where-Object DisplayName -eq 'DevNotes').$1" | tr -d '\r"'
pwsh -NoProfile -Command "(Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' -ErrorAction SilentlyContinue | Where-Object DisplayName -eq '$name').$1" | tr -d '\r"'
}
for _ in $(seq 1 120); do
found=$(entry DisplayVersion)
folder=$(entry InstallLocation)
if [ "$found" = "$expected" ] && [ -f "$folder/devnotes.exe" ]; then
if [ "$found" = "$expected" ] && [ -f "$folder/$slug.exe" ]; then
echo "installed: $expected in $folder"
exit 0
fi
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ jobs:
version=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "app") | .version')
echo "version=$version" >> "$GITHUB_OUTPUT"

- name: Read the names
id: names
run: |
echo "name=$(node scripts/names.mjs display-name)" >> "$GITHUB_OUTPUT"
echo "slug=$(node scripts/names.mjs slug)" >> "$GITHUB_OUTPUT"

- name: The run's signing key
if: inputs.environment == ''
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
Expand Down Expand Up @@ -125,6 +131,7 @@ jobs:
if: matrix.system == 'linux'
uses: ./.github/actions/package/deb
with:
slug: ${{ steps.names.outputs.slug }}
version: ${{ steps.version.outputs.version }}
private-key: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY || env.RUN_KEY }}
password: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
Expand All @@ -134,6 +141,7 @@ jobs:
if: matrix.system == 'linux'
uses: ./.github/actions/package/rpm
with:
slug: ${{ steps.names.outputs.slug }}
version: ${{ steps.version.outputs.version }}
private-key: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY || env.RUN_KEY }}
password: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
Expand All @@ -143,6 +151,7 @@ jobs:
if: matrix.system == 'linux'
uses: ./.github/actions/package/appimage
with:
slug: ${{ steps.names.outputs.slug }}
private-key: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY || env.RUN_KEY }}
password: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
out: dist
Expand All @@ -151,6 +160,7 @@ jobs:
if: matrix.system == 'windows'
uses: ./.github/actions/package/nsis
with:
slug: ${{ steps.names.outputs.slug }}
private-key: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY || env.RUN_KEY }}
password: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
out: dist
Expand All @@ -159,6 +169,8 @@ jobs:
if: startsWith(matrix.system, 'macos')
uses: ./.github/actions/package/dmg
with:
name: ${{ steps.names.outputs.name }}
slug: ${{ steps.names.outputs.slug }}
version: ${{ steps.version.outputs.version }}
private-key: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY || env.RUN_KEY }}
password: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
Expand All @@ -168,13 +180,15 @@ jobs:
if: matrix.system == 'linux'
env:
VERSION: ${{ steps.version.outputs.version }}
run: cp target/release/devnotes "dist/devnotes-$VERSION-linux"
SLUG: ${{ steps.names.outputs.slug }}
run: cp "target/release/$SLUG" "dist/$SLUG-$VERSION-linux"

- name: Standalone executable
if: matrix.system == 'windows'
env:
VERSION: ${{ steps.version.outputs.version }}
run: cp target/release/devnotes.exe "dist/devnotes-$VERSION-windows.exe"
SLUG: ${{ steps.names.outputs.slug }}
run: cp "target/release/$SLUG.exe" "dist/$SLUG-$VERSION-windows.exe"

- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
Expand Down
Loading