]> xn--ix-yja.es Git - alex.git/commitdiff
Add blog build
authoralex <alex@pdp7.net>
Thu, 12 Oct 2023 18:08:47 +0000 (20:08 +0200)
committeralex <alex@pdp7.net>
Thu, 12 Oct 2023 19:55:54 +0000 (21:55 +0200)
.github/workflows/build-blog.yml [new file with mode: 0644]
blog_experiment/build.rs [new file with mode: 0755]

diff --git a/.github/workflows/build-blog.yml b/.github/workflows/build-blog.yml
new file mode 100644 (file)
index 0000000..e63d621
--- /dev/null
@@ -0,0 +1,24 @@
+on:
+  push:
+    paths:
+      - 'blog_experiment/**'
+    branches:
+      - master
+  workflow_dispatch:
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          submodules: true
+      - run: |
+          cd blog_experiment
+          rustup toolchain install nightly --profile minimal
+          podman login quay.io -u $USER -p $TOKEN --authfile ~/docker-config
+          chmod ugo+r ~/docker-config
+          ./build.rs --docker-config ~/docker-config . quay.io/alexpdp7/blog:latest
+        env:
+          USER: ${{ vars.BLOG_ROBOT_USERNAME }}
+          TOKEN: ${{ secrets.BLOG_ROBOT_TOKEN }}
diff --git a/blog_experiment/build.rs b/blog_experiment/build.rs
new file mode 100755 (executable)
index 0000000..0e36635
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/env -S cargo +nightly -Zscript
+```cargo
+[dependencies]
+clap = { version = "4.4.6", features = ["derive", "env"] }
+paars = { git = "https://github.com/alexpdp7/paars.git" }
+```
+use std::path::PathBuf;
+use clap::Parser;
+
+#[derive(Parser, Debug)]
+#[command()]
+struct Args {
+    #[clap(long, env)]
+    docker_config: PathBuf,
+
+    #[clap()]
+    dir: PathBuf,
+
+    #[clap()]
+    image: String,
+}
+
+fn main() {
+    let args = Args::parse();
+    paars::build_image(args.dir, args.docker_config, args.image);
+}