Skip to content

Commit e7b24bf

Browse files
committed
chore: harden CI workflows
1 parent 6743f1b commit e7b24bf

4 files changed

Lines changed: 15 additions & 16 deletions

File tree

.github/workflows/nightly.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,16 @@ jobs:
181181
run: |
182182
tag="nightly-${{ needs.prepare-sources.outputs.datestring }}"
183183
published=$(date -u +%Y-%m-%dT%H:%M:%SZ)
184-
cat > manifest.json <<JSON
185-
{
186-
"tag": "${tag}",
187-
"publishedAt": "${published}",
188-
"assetUrl": "https://github.com/${{ github.repository }}/releases/download/${tag}/logseq-linux-x64-${{ needs.prepare-sources.outputs.version }}.tar.gz",
189-
"assetSha256": "${{ steps.hash.outputs.sri }}",
190-
"logseqRev": "${{ needs.prepare-sources.outputs.revision }}",
191-
"logseqVersion": "${{ needs.prepare-sources.outputs.version }}"
192-
}
193-
JSON
194-
184+
asset_url="https://github.com/${{ github.repository }}/releases/download/${tag}/logseq-linux-x64-${{ needs.prepare-sources.outputs.version }}.tar.gz"
185+
printf '%s\n' \
186+
'{' \
187+
" \"tag\": \"$tag\"," \
188+
" \"publishedAt\": \"$published\"," \
189+
" \"assetUrl\": \"$asset_url\"," \
190+
" \"assetSha256\": \"${{ steps.hash.outputs.sri }}\"," \
191+
" \"logseqRev\": \"${{ needs.prepare-sources.outputs.revision }}\"," \
192+
" \"logseqVersion\": \"${{ needs.prepare-sources.outputs.version }}\"" \
193+
'}' > manifest.json
195194
- name: Update manifest file
196195
run: |
197196
mv manifest.json data/logseq-nightly.json

.github/workflows/validate.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ jobs:
2323
run: nix build .#logseq
2424

2525
- name: Smoke test launcher
26+
if: env.ACT != 'true'
2627
run: nix run .#logseq -- --version

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@
9494
formatter = pkgs.nixpkgs-fmt;
9595
}
9696
) // {
97-
nixosModules.logseq = import ./modules/logseq-module.nix self;
97+
nixosModules.logseq = import ./modules/logseq-module.nix;
9898
};
9999
}

modules/logseq-module.nix

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
self:
21
{ config, lib, pkgs, ... }:
32
let
43
inherit (lib) mkIf mkOption types attrByPath isString mkMerge mkDefault optionals;
54
cfg = config.services.logseq;
65
ownerUsername = attrByPath [ "flake" "lib" "meta" "owner" "username" ] config null;
7-
defaultUser = if isString ownerUsername then ownerUsername else null;
6+
defaultUser = if isString ownerUsername then ownerUsername else "vx";
87
nixCmd = "${cfg.nixBinary}/bin/nix";
98
syncScript = pkgs.writeShellApplication {
109
name = "logseq-sync";
@@ -41,7 +40,7 @@ let
4140
fi
4241
'';
4342
};
44-
defaultPackage = mkDefault (self.packages.${pkgs.system}.logseq);
43+
defaultPackage = mkDefault pkgs.emptyDirectory;
4544
in
4645
{
4746
options.services.logseq = {
@@ -71,7 +70,7 @@ in
7170

7271
user = mkOption {
7372
type = types.str;
74-
default = if defaultUser != null then defaultUser else (throw "services.logseq.user must be set when flake owner is undefined");
73+
default = defaultUser;
7574
description = "System user that should run the sync job.";
7675
};
7776

0 commit comments

Comments
 (0)