feat(github): Add basic templating support for Github Actions
This commit is contained in:
parent
3b07758709
commit
7ce70480bf
2 changed files with 15 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use std::{
|
||||
collections::HashMap,
|
||||
fs,
|
||||
env, fs,
|
||||
path::{Path, PathBuf},
|
||||
process,
|
||||
};
|
||||
|
|
@ -164,6 +164,16 @@ impl TemplateCommand {
|
|||
},
|
||||
);
|
||||
|
||||
debug!("Registering function `running_gitlab_actions`");
|
||||
tera.register_function(
|
||||
"running_gitlab_actions",
|
||||
|_: &HashMap<String, tera::Value>| -> tera::Result<tera::Value> {
|
||||
trace!("tera fn running_gitlab_actions()");
|
||||
|
||||
Ok(env::var("GITHUB_ACTIONS").is_ok_and(|e| e == "true").into())
|
||||
},
|
||||
);
|
||||
|
||||
Ok((tera, context))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
FROM {{ base_image }}:{{ image_version }}
|
||||
|
||||
ARG RECIPE={{ recipe }}
|
||||
{%- if running_gitlab_actions() %}
|
||||
ARG IMAGE_REGISTRY=ghcr.io/ublue-os
|
||||
COPY cosign.pub /usr/share/ublue-os/cosign.pub
|
||||
{%- endif %}
|
||||
|
||||
# Copy the bling from ublue-os/bling into tmp, to be installed later by the bling module
|
||||
# Feel free to remove these lines if you want to speed up image builds and don't want any bling
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue