Skip to content

Commit f2e5c01

Browse files
committed
enables container registry publish, adds new test workflow.
1 parent d81a717 commit f2e5c01

File tree

3 files changed

+57
-16
lines changed

3 files changed

+57
-16
lines changed

.gitea/workflows/workflow_publish.yaml .gitea/workflows/publish.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
runs-on: akashi
1313
# Using custom ArchLinux based action runner from private registry
1414
container:
15-
image: gitea-service:80/smdd/arch-action-runner:latest
15+
image: gitea-service:80/actions/arch-action-runner-full:latest
1616
options: "--security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/fuse:rw" # container setup for buildah
1717
credentials:
1818
username: ${{secrets.REGISTRY_USERNAME}}
1919
password: ${{secrets.REGISTRY_ACCESS_TOKEN}}
2020
steps:
2121
- uses: http://gitea-service/actions/checkout@v4
2222
with:
23-
fetch-depth: 0
23+
show-progress: false
2424
- name: Setup rustup targets and pnpm
2525
run: |
2626
rustup default stable;
@@ -45,7 +45,11 @@ jobs:
4545
source ./containers/annotation.conf;
4646
MAJOR_MINOR_TAG=$(echo -n "${VERSION}" | awk -F '.' '{print $1"."$2}');
4747
ALIAS_TAGS="latest ${MAJOR_MINOR_TAG}";
48-
./build_images.sh -a "${ALIAS_TAGS}" && buildah images;
48+
./build_images.sh -a "${ALIAS_TAGS}" -r "${REGISTRY_URL}" -u "${REGISTRY_USERNAME}" -p "${REGISTRY_PASSWORD}";
49+
env:
50+
REGISTRY_URL: ${{secrets.REGISTRY_URL}}
51+
REGISTRY_USERNAME: ${{secrets.REGISTRY_USERNAME}}
52+
REGISTRY_PASSWORD: ${{secrets.REGISTRY_ACCESS_TOKEN}}
4953
- name: Generate release body from changelog
5054
run: >
5155
source ./containers/annotation.conf;

.gitea/workflows/test.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: test
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
publish-binaries:
8+
defaults:
9+
run:
10+
shell: bash
11+
runs-on: akashi
12+
container:
13+
image: gitea-service:80/actions/arch-action-runner-full:latest
14+
credentials:
15+
username: ${{secrets.REGISTRY_USERNAME}}
16+
password: ${{secrets.REGISTRY_ACCESS_TOKEN}}
17+
steps:
18+
- uses: http://gitea-service/actions/checkout@v4
19+
with:
20+
show-progress: false
21+
- name: Setup rustup targets and pnpm
22+
run: |
23+
rustup default stable;
24+
corepack enable pnpm;
25+
pnpm --version;
26+
- name: Run tests
27+
run: make test

build_images.sh

+23-13
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@ C_R='\033[0;31m' # color red
88
C_Y='\033[0;33m' # color yellow
99
C_Cy='\033[0;36m' # color cyan
1010

11-
REGISTRY=""
12-
TLS_VERIFY="false"
13-
ALIAS_TAGS=""
14-
DRY_RUN="false"
15-
PUBLISH="false"
16-
ANNOTATION_CONF="./containers/annotation.conf"
17-
18-
while getopts "hdtp:a:c:" opt; do
11+
REGISTRY="";
12+
TLS_VERIFY="false";
13+
ALIAS_TAGS="";
14+
DRY_RUN="false";
15+
PUBLISH="false";
16+
ANNOTATION_CONF="./containers/annotation.conf";
17+
USER_NAME="";
18+
USER_PASS="";
19+
20+
while getopts "hdtu:p:a:c:r:" opt; do
1921
case $opt in
2022
"d")
2123
DRY_RUN="true";
2224
;;
23-
"p")
25+
"r")
2426
PUBLISH="true";
2527
REGISTRY="${OPTARG}";
2628
if [[ -z "$REGISTRY" ]]; then
@@ -31,6 +33,12 @@ while getopts "hdtp:a:c:" opt; do
3133
"t")
3234
TLS_VERIFY="true";
3335
;;
36+
"u")
37+
USER_NAME="${OPTARG}";
38+
;;
39+
"p")
40+
USER_PASS="${OPTARG}";
41+
;;
3442
"a")
3543
ALIAS_TAGS="${OPTARG}";
3644
;;
@@ -43,13 +51,15 @@ while getopts "hdtp:a:c:" opt; do
4351
fi
4452
;;
4553
"h")
46-
printf "Usage %s: [-h] [-d] [-p registry] [-t] [-a alias-tags].\n" $0
54+
printf "Usage %s: [-h] [-d] [-r registry] [-t] [-a alias-tags] [-l username] [-p password].\n" $0
4755
echo "Arguments:"
4856
echo " -h : Help menu."
4957
echo " -d : Dry-run. Only prints messages."
50-
echo " -p <registry-url> : Pushes images and manifest to the target registry."
58+
echo " -r <registry-url> : Pushes images and manifest to the target registry."
5159
echo " -t : Enable TLS verification. Default is false."
52-
echo " -a <tag1;tag2;...> : Additional alias tags separeted with semicolons (;)"
60+
echo " -a <tag1 tag2 ...> : Additional alias tags separated with spaces"
61+
echo " -u <username> : Registry username to login"
62+
echo " -p <password> : User password"
5363
exit 2;
5464
;;
5565
?)
@@ -171,7 +181,7 @@ done;
171181

172182
if [[ "$PUBLISH" == "true" ]]; then
173183
test "${DRY_RUN}" != "true" && \
174-
buildah login --tls-verify="${TLS_VERIFY}" "${REGISTRY}"
184+
buildah login --tls-verify="${TLS_VERIFY}" -u "${USER_NAME}" -p "${USER_PASS}" "${REGISTRY}";
175185

176186
TAG_LIST=("${VERSION}" ${ALIAS_TAGS[@]});
177187
for TAG in "${TAG_LIST[@]}";

0 commit comments

Comments
 (0)