Compare commits

...
Author SHA1 Message Date
dzu
0778593715 add main action script 2026-02-13 13:48:36 +00:00
dzu
e307bca981 add action definition as yml 2026-02-13 13:48:19 +00:00
dzu
d69ea2e139 ch: default git refs to "default for the repo" 2026-02-13 13:46:24 +00:00
dzu
e5eb2a23df remove the fallback git token input 2026-02-13 12:10:31 +00:00
3 changed files with 89 additions and 5 deletions

View file

@ -2,16 +2,15 @@
|name|default|note| |name|default|note|
|:---:|:---:|:---:| |:---:|:---:|:---:|
|token-git|-|master token used for git operations. not required. will be used as a fallback if any of the other two tokens is left unspecified|
|build-image|git.dzuchun.ing/actions/anode-builder:latest|image the build process will undergo on. you may want to override it with your own image, if you use static libraries not installed on the default image| |build-image|git.dzuchun.ing/actions/anode-builder:latest|image the build process will undergo on. you may want to override it with your own image, if you use static libraries not installed on the default image|
|src-repository|-|git repository to clone action's Rust source from| |src-repository|-|git repository to clone action's Rust source from|
|src-ref|master|ref of the source repository to use| |src-ref|(whatever the default branch is)|ref of the source repository to use|
|src-actor|actions|actor for cloning the action source| |src-actor|actions|actor for cloning the action source|
|src-token|(token input)|a git token to used to perform a git clone of the action source. not required; action may fail of the git server refuses the operation| |src-token|-|a git token to used to perform a git clone of the action source. not required; action may fail of the git server refuses the operation|
|dst-repository|-|git repository to push the compiled action to| |dst-repository|-|git repository to push the compiled action to|
|dst-ref|master|ref of the repository to push the compiled action to.| |dst-ref|(whatever the default branch is)|ref of the repository to push the compiled action to.|
|dst-actor|actions|actor pushing the compiled action| |dst-actor|actions|actor pushing the compiled action|
|dst-token|(token input)|a git token to used to perform the git push of the compiled action to the destination repository. not required. git server is very likely to refuse the push if you leave this blank| |dst-token|-|a git token to used to perform the git push of the compiled action to the destination repository. not required. git server is very likely to refuse the push if you leave this blank|
|opt-release|false|use release profile| |opt-release|false|use release profile|
|opt-build-std|false|use nightly toolchain with build-std feature| |opt-build-std|false|use nightly toolchain with build-std feature|
|opt-upx|false|use UPX to compress the binary even further. please note that this subjects you to UPX's terms of use.| |opt-upx|false|use UPX to compress the binary even further. please note that this subjects you to UPX's terms of use.|

45
action.yml Normal file
View file

@ -0,0 +1,45 @@
name: 'Build anode action'
description: 'Checkout, build and update the anode action'
inputs:
build-image:
description: 'OCI image to use for building the action'
default: git.dzuchun.ing/actions/anode-builder:master
required: false
src-repository:
description: 'Git repository to clone the the action source from'
required: true
src-ref:
description: 'Git tag to clone the action source from'
required: false
src-actor:
description: 'Git use to clone the action source as'
default: actions
src-token:
description: 'Git token to use for cloning the action source'
required: false
dst-repository:
description: 'Git repository to upload the compiled actio to'
required: true
dst-ref:
description: 'Git branch to upload the compiled action to'
required: false
dst-actor:
description: 'Git user to upload the action as'
default: actions
dst-token:
description: 'Git token to use whiee uploading the action'
required: false
opt-release:
description: 'Use Rust release profile while compiling the action'
default: false
opt-build-std:
description: 'Use nightly Rust toolchain, and `build-std` feature'
default: false
opt-upx:
description: 'Compress the resulting biinary this UPX'
default: false
runs:
using: composite
steps:
- run: ${{ forgejo.action_path }}/main.sh
shell: bash

40
main.sh Executable file
View file

@ -0,0 +1,40 @@
#!/bin/bash
set -eu
BUILDER_IMAGE=$(printenv INPUT-BUILD-IMAGE)
SRC_REPOSITORY=$(printenv INPUT-SRC-REPOSITORY)
SRC_REF=$(printenv INPUT-SRC-REF:-master)
SRC_ACTOR=$(printenv INPUT-SRC-REF:-actions)
SRC_TOKEN=$(printenv INPUT-SRC-TOKEN)
DST_REPOSITORY=$(printenv INPUT-DST-REPOSITORY)
DST_REF=$(printenv INPUT-DST-REF:-master)
DST_ACTOR=$(printenv INPUT-DST-REF:-actions)
DST_TOKEN=$(printenv INPUT-DST-TOKEN)
OPT_RELEASE=$(printenv INPUT-OPT-RELEASE:-false)
OPT_BUILD_STD=$(printenv INPUT-OPT-BUILD-STD:-false)
OPT_UPX=$(printenv INPUT-OPT-UPX:-false)
GIT_FPUSH=$(printenv INPUT-GIT-FPUSH:-false)
echo "SRC_REPOSITORY=$SRC_REPOSITORY" > .env
echo "SRC_REF=$SRC_REF" >> .env
echo "SRC_ACTOR=$SRC_ACTOR" >> .env
echo "SRC_TOKEN=$SRC_TOKEN" >> .env
echo "DST_REPOSITORY=$DST_REPOSITORY" >> .env
echo "DST_REF=$DST_REF" >> .env
echo "DST_ACTOR=$DST_ACTOR" >> .env
echo "DST_TOKEN=$DST_TOKEN" >> .env
echo "OPT_RELEASE=$OPT_RELEASE" >> .env
echo "OPT_BUILD_STD=$OPT_BUILD_STD" >> .env
echo "OPT_UPX=$OPT_UPX" >> .env
echo "GIT_FPUSH=$GIT_FPUSH" >> .env
docker container run --attach --env-file .env --rm -t $BUILDER_IMAGE /bin/sh /build.sh
rm .env