Skip to content

Commit

Permalink
Improved docs of &which, changed mepinst to use simple jmp.idx format…
Browse files Browse the repository at this point in the history
… and a single latest release built by github action build-webpages

Up'd version to 20241201
  • Loading branch information
bjasspa committed Dec 24, 2024
1 parent 62cbbdb commit 2e41d2b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 11 deletions.
38 changes: 38 additions & 0 deletions microemacs/contribs/github.emf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ set-variable $time 0
!emacro

; Build an action with given commit
; @# - if 0 don't download artifacts
; @1 - Commit SHA1
; @2 - Name of action to build
; @3 - Full path to the artifact directory
Expand Down Expand Up @@ -106,6 +107,7 @@ define-macro github-build-action
!done
!iif &not &seq "completed" #l3 -8 ml-write &spr "[Github %s Error: Unexpected state %s for run id %s]" #l0 #l3 #l5
!iif &not &seq "success" &set #l3 &rig &reg "/json/ghaj/conclusion" "" 1 -8 ml-write &spr "[Github %s Error: Workflow run failed for run id %s, conclusion: %s]" #l0 #l5
!iif &not @# !return
github-api-json &spr "actions/runs/%s/artifacts" #l5
!iif &or &not &seq "[" &lef &set #l2 &reg "/json/ghaj/artifacts" "" 1 &seq &set #l6 &rig #l2 1 "" -8 ml-write &spr "[Github %s Error: Unexpected artifacts array: %s]" #l0 #l2
set-variable #l3 0
Expand Down Expand Up @@ -161,6 +163,15 @@ define-macro github-build
!force 0x100 file-op &cat #l1 "downloads"
!force 0x100 file-op &cat #l1 "packages"
ml-write &spr "[Github Build: Output to %s]" #l1
find-file &cat #l1 "commit_sha.txt"
beginning-of-buffer
set-mark
end-of-buffer
-1 kill-region
insert-string #l0
-1 buffer-mode "backup"
save-buffer
!force 0 delete-buffer $buffer-bname
set-variable #l4 ""
set-variable #l2 0
!while &not &seq "" &set #l3 &lget .git.hub-bal &inc #l2 1
Expand All @@ -181,6 +192,26 @@ define-macro github-release
set-variable #l1 @3
!iif &not &seq "D" &stat t #l1 -8 ml-write &spr "[Github Release Error: Failed to locate given release directory - %s]" #l1
!iif &not &seq "D" &stat t &cat #l1 "downloads" -8 ml-write &spr "[Github Release Error: Failed to locate given release downloads directory - %sdownloads]" #l1
!if &not &seq "R" &stat t &cat #l1 "downloads/Jasspa_MicroEmacs_Latest_packages.zip"
!iif &not &seq "D" &stat t &cat #l1 "packages" -8 ml-write &spr "[Github Release Error: Failed to locate given release packages directory - %spackages]" #l1
ml-write "[Github Build: Generating packages zip]"
find-file &cat #l1 "packages/jmp.idx"
beginning-of-buffer
set-mark
end-of-buffer
-1 kill-region
insert-string &cat "JMP2\n20241201\n" #l9
-1 buffer-mode "backup"
save-buffer
!force 0 delete-buffer $buffer-bname
!force 0 delete-buffer "*ghr1*"
find-buffer "*ghr1*"
set-variable $buffer-fname #l1
shell-command "zip -r downloads/Jasspa_MicroEmacs_Latest_packages.zip packages"
!iif $result -8 ml-write &spr "[Github Release Error: Failed to create packages zip - zip returned %d]" $result
!iif &not &seq "R" &stat t &cat #l1 "Jasspa_MicroEmacs_Latest_packages.zip" -8 ml-write &spr "[Github Release Error: Failed to create packages zip - file not found]"
!force 0 delete-buffer "*ghr1*"
!endif
github-api-json "releases" "" &spr "{\"tag_name\":\"%s%s\",\"target_commitish\":\"%s\",\"name\":\"%s%s\",\"generate_release_notes\":false,\"draft\":false,\"prerelease\":true}" .git.hub-rtp #l9 #l0 .git.hub-rnp #l9
!iif &not &xseq &set #l8 &rig &reg &spr "/json/ghaj/id" "" 1 "\\h+" -8 ml-write &spr "[Github Release Error: Unexpected release ID - %s]" #l8
!iif &not &seq "\"http" &lef &set #l2 &reg "/json/ghaj/upload_url" "" 5 -8 ml-write &spr "[Github Release Error: Unexpected upload_url %s]" #l2
Expand Down Expand Up @@ -371,6 +402,7 @@ define-macro github-finalise-release
!force set-variable #l3 @3
!iif &not $status set-variable #l3 @ml61 "Release artifact directory" &spr "~/%s%s" .git.hub-rtp #l1
!iif &not &seq "D" &stat t &set #l3 &stat a #l3 -8 ml-write &spr "[Github Release Error: Given artifact directory is not a directory: %s]" #l3
!iif &not &seq "R" &stat t &cat #l3 "commit_sha.txt" -8 ml-write &spr "[Github Release Error: Cannot locate release build commit sha: %scommit_sha.txt]" #l3
!iif &not &seq "R" &stat t &set #l4 &spr "%sJasspa_MicroEmacs_%s-sha256.txt" #l3 #l1 -8 ml-write &spr "[Github Release Error: Cannot locate main formula file: %s]" #l3
!force 0 delete-buffer "*ghdh"
find-buffer "*ghdh"
Expand Down Expand Up @@ -398,6 +430,12 @@ define-macro github-finalise-release
github-api-json &cat "releases/" &rig #l9 1 "PATCH" "{\"prerelease\":false,\"make_latest\":true}"
!iif &not &seq &set #l2 &reg "/json/ghaj/id" "" #l9 -8 ml-write &spr "[Github Release Error: Unexpected release ID returned - %s]" #l2
!iif &not &seq &set #l2 &reg "/json/ghaj/prerelease" "" "b0" -8 ml-write &spr "[Github Release Error: Unexpected prerelease setting %s]" #l2
; run the build-webpages action to update docs and packages
find-file &cat #l3 "commit_sha.txt"
beginning-of-buffer
set-variable #l0 @wl
!force 0 delete-buffer $buffer-bname
0 github-build-action #l0 "build-webpages.yml" #l1 ""
goto-position "\x80"
ml-write "[Release Finalised - commit changes to jasspa & homebrew-jasspa repositories]"
!emacro
16 changes: 9 additions & 7 deletions microemacs/doc/m4fil024.4
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.\" Copyright (c) 1998-2009 JASSPA (www.jasspa.com)
.\" See the file "me.nrs" for copying and conditions.
.\"
.Id $Id: m4fil024.4,v 2.8 2024/11/11 15:58:44 jon Exp $
.Id $Id: m4fil024.4,v 2.8 2024/12/22 21:42:54 jon Exp $
.Im MicroEmacs macro;function;miscellaneous
.so me.tni
.TH &find 4
Expand Down Expand Up @@ -34,10 +34,9 @@ initialized by the system of from the the environment variables
.Ht $MEINSTALLPATH 5
etc.
.PP
Each path component defined in \fB$search-path\fR is prepended to the
constructed file name and it's existence is tested. If the file exists, then
the \s-1FULL\s0 path name of the file is returned to the caller, otherwise
\fCERROR\fR.
Each path component defined in \fB$search-path\fR is prepended to the constructed file name and it's existence is
tested. If the file exists, then the \s-1FULL\s0 path name of the file is returned to the caller, otherwise the string
"\fCERROR\fR" is returned.
.IP "\fI<basename>\fR"
The base name of the file, excluding any extension.
.IP "\fI<extension>\fR"
Expand All @@ -48,8 +47,11 @@ The extension of the file name, this must be specified with the extension del
for more information on \*(mS list format and functions.
.PP
.B &which
searches for the given executable program \fI<progname>\fR on the system
program search path defined the the environment variable \fB$PATH\fR.
searches for the given executable program \fI<progname>\fR on the system program search path defined by the
environment variable \fB$PATH\fR. If the program is found, then the \s-1FULL\s0 path to the program is returned,
otherwise the string "\fCERROR\fR" is returned.
.PP
Note that on dos and Windows only the extensions \fC.bat\fR, \fB.cmd\fR, \fC.com\fR and \fC.exe\fR are checked for.
.SH USAGE
.B &find
is typically used with
Expand Down
2 changes: 1 addition & 1 deletion microemacs/macros/hkshell.emf
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ set-variable .fhook-shell.item-list-r1 "Func \ecB\\1\ecA"
; Variables.
hilight .hilight.shell 4 "\\$" "\\}\\W" "" .scheme.variable
hilight .hilight.shell 0x80 "\\${" .hilight.shellV .scheme.variable
hilight .hilight.shell 4 "\\$(" ")\\s" "" .scheme.variable
hilight .hilight.shell 4 "\\$(" ")\\s" "" .scheme.variable
hilight .hilight.shell 0 "\\$\\?" .scheme.variable
hilight .hilight.shell 0 "\\$#" .scheme.variable
hilight .hilight.shell 0 "\\$\\$" .scheme.variable
Expand Down
1 change: 0 additions & 1 deletion microemacs/macros/mepinst.emf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
; Synopsis: MicroEmacs package installer
; Authors: Steven Phillips
;
set-variable .help.purl "http://d1j8pqz26umfbo.cloudfront.net/packages/"
set-variable .help.purl "http://docs.asid.family/packages/"

0 define-macro me-pinstall
Expand Down
4 changes: 2 additions & 2 deletions microemacs/src/evers.mak
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
#
meVER_CN = 20
meVER_YR = 24
meVER_MN = 11
meVER_DY = 2
meVER_MN = 12
meVER_DY = 1

0 comments on commit 2e41d2b

Please sign in to comment.