Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Heptazhou committed Apr 1, 2024
1 parent ced81b1 commit 2947630
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 62 deletions.
1 change: 1 addition & 0 deletions .github/packages/libcurl-julia-bin/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libcurl-julia-bin-v1.10-1
1 change: 1 addition & 0 deletions .github/packages/nsis/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nsis-v3.09-1
14 changes: 10 additions & 4 deletions .github/workflows/make-libcurl-julia-bin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@ on:
workflow_dispatch: ~
push:
branches:
- "libcurl-julia-bin"
- "master"
paths:
- ".github/packages/libcurl-julia-bin/version.txt"

jobs:
makepkg:
container: archlinux:base-devel
runs-on: ubuntu-latest
steps:
- run: pacman-key --init
- run: pacman -Syu --noconfirm dbus-daemon-units git github-cli
- uses: actions/checkout@v4
with:
persist-credentials: false
path: libcurl-julia-bin
ref: libcurl-julia-bin
- run: pacman-key --init
- run: pacman -Syu --noconfirm dbus-daemon-units
- run: |-
makepkg -V
echo 'PACKAGER="Heptazhou <[email protected]>"' >> /etc/makepkg.conf
sed -re 's/\b(EUID) == 0\b/\1 < -0/g' -i /bin/makepkg
sed -re 's/^#?(PACKAGER).*$/\1="Heptazhou <[email protected]>"/g' -i /etc/makepkg.conf
- run: |-
cd libcurl-julia-bin
makepkg -si --noconfirm
Expand All @@ -29,3 +31,7 @@ jobs:
with:
compression-level: 0
path: "*.pkg.tar.zst"
- run: gh release create -p --target libcurl-julia-bin libcurl-julia-bin-v1.10-1 *.pkg.tar.zst
env:
GH_REPO: ${{ env.GITHUB_REPOSITORY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 10 additions & 4 deletions .github/workflows/make-nsis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ on:
workflow_dispatch: ~
push:
branches:
- "nsis"
- "master"
paths:
- ".github/packages/nsis/version.txt"

jobs:
makepkg:
container: archlinux:base-devel
runs-on: ubuntu-latest
steps:
- run: pacman-key --init
- run: pacman -Syu --noconfirm dbus-daemon-units git github-cli
- uses: actions/checkout@v4
with:
persist-credentials: false
Expand All @@ -19,12 +23,10 @@ jobs:
persist-credentials: false
path: nsis
ref: nsis
- run: pacman-key --init
- run: pacman -Syu --noconfirm dbus-daemon-units
- run: |-
makepkg -V
echo 'PACKAGER="Heptazhou <[email protected]>"' >> /etc/makepkg.conf
sed -re 's/\b(EUID) == 0\b/\1 < -0/g' -i /bin/makepkg
sed -re 's/^#?(PACKAGER).*$/\1="Heptazhou <[email protected]>"/g' -i /etc/makepkg.conf
- run: |-
cd mingw-w64-zlib
makepkg -si --noconfirm
Expand All @@ -38,3 +40,7 @@ jobs:
with:
compression-level: 0
path: "*.pkg.tar.zst"
- run: gh release create -p --target nsis nsis-v3.09-1 *.pkg.tar.zst
env:
GH_REPO: ${{ env.GITHUB_REPOSITORY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123 changes: 69 additions & 54 deletions workflows.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using OrderedCollections: OrderedDict as ODict
using YAML: YAML, yaml

const PACKAGER = "Heptazhou <[email protected]>"
const YAML.yaml(xs...) = join(map(yaml, xs), "\n")
macro S_str(string)
:(Symbol($string))
Expand All @@ -33,84 +34,98 @@ const ACT_CHECKOUT(xs::Pair...) = ODict(
S"uses" => S"actions/checkout@v4",
S"with" => ODict(S"persist-credentials" => false, xs...),
)
const ACT_GH(cmd::String) = ODict(
S"run" => Symbol(cmd),
S"env" => ODict(
S"GH_REPO" => S"${{ env.GITHUB_REPOSITORY }}",
S"GH_TOKEN" => S"${{ secrets.GITHUB_TOKEN }}",
),
)
const ACT_SYNC(pkgbase::String) = ODict(
S"uses" => S"repo-sync/[email protected]",
S"with" => ODict(
S"source_repo" => Symbol("https://aur.archlinux.org/$pkgbase.git"),
S"source_branch" => S"master",
S"destination_branch" => Symbol("$pkgbase"),
S"destination_branch" => Symbol(pkgbase),
S"github_token" => S"${{ secrets.PAT }}",
),
)

const JOB_MAKE(pkgbases::Vector{String}, tag::String) = ODict(
S"container" => S"archlinux:base-devel",
S"runs-on" => S"ubuntu-latest",
S"steps" => [
S"run" .=> [
S"pacman-key --init"
S"pacman -Syu --noconfirm dbus-daemon-units git github-cli"
]
ACT_CHECKOUT.(sort(pkgbases))
S"run" .=> [
"""
makepkg -V
sed -re 's/\\b(EUID) == 0\\b/\\1 < -0/g' -i /bin/makepkg
sed -re 's/^#?(PACKAGER).*\$/\\1="$PACKAGER"/g' \
-i /etc/makepkg.conf"""
map(pkgbase -> strip("""
cd $pkgbase
makepkg -si --noconfirm
mv -vt .. *.pkg.tar.zst
"""), pkgbases)
S"ls -lav *.pkg.tar.zst"
]
ACT_ARTIFACT("*.pkg.tar.zst")
ACT_GH("gh release create -p --target " * pkgbases[end] *
" $tag *.pkg.tar.zst")
],
)
const JOB_SYNC(pkgbase::String) = ODict(
S"runs-on" => S"ubuntu-latest",
S"steps" => [ACT_CHECKOUT(), ACT_SYNC(pkgbase)],
)
const MAKEPKG(pkgbases::Vector{String}) = ODict(
S"makepkg" => ODict(
S"container" => S"archlinux:base-devel",
S"runs-on" => S"ubuntu-latest",
S"steps" => [
ACT_CHECKOUT.(sort(pkgbases));
S"run" .=> [
S"pacman-key --init"
S"pacman -Syu --noconfirm dbus-daemon-units"
"""
makepkg -V
echo 'PACKAGER="Heptazhou <[email protected]>"' >> /etc/makepkg.conf
sed -re 's/$(s"\b(EUID) == 0\b/\1 < -0")/g' -i /bin/makepkg"""
map(pkgbase -> strip("""
cd $pkgbase
makepkg -si --noconfirm
mv -vt .. *.pkg.tar.zst
"""), pkgbases)...
S"ls -lav *.pkg.tar.zst"
]
ACT_ARTIFACT("*.pkg.tar.zst")
],
),
)

function makepkg(pkgbases::Vector{String}, v::String)
p = pkgbases[end]
f = ".github/packages/$p/version.txt"
mkpath(dirname(f))
write(f, "$p-v$v", "\n")
write(".github/workflows/make-$p.yml",
yaml(
S"on" => ODict(
S"workflow_dispatch" => nothing,
S"push" => ODict(
S"branches" => ["master"],
S"paths" => [f],
),
),
S"jobs" => ODict(
S"makepkg" => JOB_MAKE(pkgbases, "$p-v$v"),
),
),
)
end

write(".github/workflows/repo-sync.yml",
yaml(
S"on" => ODict(
S"workflow_dispatch" => nothing,
S"schedule" => [ODict(S"cron" => "0 */4 * * *")],
),
S"jobs" => ODict([
Symbol(x) => JOB_SYNC(x) for x [
"conda-zsh-completion"
"glibc-linux4"
"iraf-bin"
"libcurl-julia-bin"
"locale-mul_zz"
"mingw-w64-zlib"
"nsis"
"xgterm-bin"
]
S"jobs" => ODict(Symbol(x) => JOB_SYNC(x) for x [
"conda-zsh-completion"
"glibc-linux4"
"iraf-bin"
"libcurl-julia-bin"
"locale-mul_zz"
"mingw-w64-zlib"
"nsis"
"xgterm-bin"
]),
),
)

# https://aur.archlinux.org/packages/libcurl-julia-bin
write(".github/workflows/make-libcurl-julia-bin.yml",
yaml(
S"on" => ODict(
S"workflow_dispatch" => nothing,
S"push" => ODict(S"branches" => ["libcurl-julia-bin"]),
),
S"jobs" => MAKEPKG(["libcurl-julia-bin"]),
),
)
makepkg(["libcurl-julia-bin"], "1.10-1")

# https://aur.archlinux.org/packages/nsis
write(".github/workflows/make-nsis.yml",
yaml(
S"on" => ODict(
S"workflow_dispatch" => nothing,
S"push" => ODict(S"branches" => ["nsis"]),
),
S"jobs" => MAKEPKG(["mingw-w64-zlib", "nsis"]),
),
)
makepkg(["mingw-w64-zlib", "nsis"], "3.09-1")

0 comments on commit 2947630

Please sign in to comment.