forked from images/gitea-image-forge
add workflow
This commit is contained in:
parent
2b7e1fec89
commit
d54807cce9
80
.gitea/workflows/wf.yaml
Normal file
80
.gitea/workflows/wf.yaml
Normal file
@ -0,0 +1,80 @@
|
||||
name: Building alt images
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*_*/*'
|
||||
env:
|
||||
url: gitea.basealt.ru
|
||||
repo: images_repo
|
||||
|
||||
jobs:
|
||||
Building_process:
|
||||
runs-on: alt-latest
|
||||
steps:
|
||||
- name: Check workspace
|
||||
run: |
|
||||
echo "runner = ${{ runner.name }}, gitea_url = ${{ gitea.server_url }}, repository = ${{ gitea.repository }}, owner = ${{ gitea.owner }}"
|
||||
- name: Update apt
|
||||
run: |
|
||||
echo "apt-get update -y && apt-get install -y apt rpm"
|
||||
apt-get update -y && apt-get install -y apt rpm
|
||||
- name: Install requires
|
||||
run: |
|
||||
echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah curl jq"
|
||||
apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah curl jq
|
||||
echo "apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc"
|
||||
apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc
|
||||
- name: Check out current repo
|
||||
uses: actions/checkout@v3
|
||||
- name: Login podman gitea
|
||||
run: |
|
||||
echo "podman login ${{ env.gitea_url }}"
|
||||
podman login --username $P_USER --password $P_PASS ${{ env.url }}
|
||||
#echo "docker login ${{ env.gitea_url }}"
|
||||
#docker login --username $P_USER --password $P_PASS ${{ env.url }}
|
||||
env:
|
||||
P_USER: ${{ secrets.PODMAN_USER }}
|
||||
P_PASS: ${{ secrets.PODMAN_PASS }}
|
||||
- name: Check files in the repository
|
||||
run: |
|
||||
ls -a ${{ gitea.workspace }}
|
||||
- name: Parse target branch and tag from events context, save to env
|
||||
env:
|
||||
EV: ${{ toJson(gitea.event) }}
|
||||
run: |
|
||||
echo $EV | jq '.ref' -r | sed "s/refs\/tags\//BRANCH=/g" | cut -d '_' -f 1
|
||||
echo $EV | jq '.ref' -r | sed "s/refs\/tags\//BRANCH=/g" | cut -d '_' -f 1 >> ${GITHUB_ENV}
|
||||
echo $EV | jq '.ref' -r | sed 's/refs\/tags\///g' | cut -d '_' -f 2
|
||||
localimage=$(echo $EV | jq '.ref' -r | sed 's/refs\/tags\///g' | cut -d '_' -f 2)
|
||||
echo "IMAGE=$localimage" >> ${GITHUB_ENV}
|
||||
- name: Run building script
|
||||
run: |
|
||||
echo "build.py -i $IM -b $BR"
|
||||
${{ gitea.workspace }}/build.py -i $IM -b $BR
|
||||
env:
|
||||
IM: ${{ env.IMAGE }}
|
||||
BR: ${{ env.BRANCH }}
|
||||
- name: Get test
|
||||
run: |
|
||||
cat ${{ gitea.workspace }}/org/$IM/test >> ${GITHUB_ENV}
|
||||
echo "TEST=${{ env.TEST }}"
|
||||
env:
|
||||
IM: ${{ env.IMAGE }}
|
||||
- name: Run test
|
||||
uses: fmidev/podman-run-action@v1
|
||||
with:
|
||||
image: ${{ env.url }}/${{ env.repo }}/${{ env.IMAGE }}:latest
|
||||
registry: ${{ env.url }}/${{ env.repo }}
|
||||
options: --rm
|
||||
run: |
|
||||
echo "${{ env.TEST }}"
|
||||
${{ env.TEST }}
|
||||
- name: Delete event tag
|
||||
run: echo "delete"
|
||||
env:
|
||||
T: {{ secrets.TOKEN }}
|
||||
- name: Send comment to issue for notification
|
||||
run: echo "send"
|
||||
env:
|
||||
T: {{secrets.TOKEN}}
|
||||
- run: echo "This job's status is ${{ job.status }}"
|
23
.gitea/workflows/wf_test.yaml
Normal file
23
.gitea/workflows/wf_test.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
name: Test event wf
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
Test event:
|
||||
runs-on: alt-latest
|
||||
steps:
|
||||
- name: Update apt
|
||||
run: apt-get update -y && apt-get install -y apt rpm
|
||||
- name: Install jq
|
||||
run: apt-get install -y jq
|
||||
- name: Get event context and parse tag name
|
||||
env:
|
||||
EV: ${{ toJson(gitea.event) }}
|
||||
run: |
|
||||
echo $EV | jq '.ref' -r | sed 's/refs\/tags\//tag=/g'
|
||||
echo $EV | jq '.ref' -r | sed 's/refs\/tags\//NEW_TAG=/g' >> ${GITHUB_ENV}
|
||||
- name: Run script
|
||||
run: echo "${{ env.NEW_TAG }}"
|
||||
- run: echo "This job's status is ${{ job.status }}"
|
6
build.py
6
build.py
@ -638,8 +638,8 @@ class ImagesInfo:
|
||||
|
||||
def parse_args():
|
||||
stages = ["build", "remove_dockerfiles", "render_dockerfiles", "push"]
|
||||
arches = ["amd64"] #, "386", "arm64", "arm", "ppc64le"]
|
||||
branches = ["p9"] #, "p10", "sisyphus"]
|
||||
arches = ["amd64", "386", "arm64", "arm", "ppc64le"]
|
||||
branches = ["p9", "p10", "sisyphus"]
|
||||
organizations = list(ORG_DIR.iterdir())
|
||||
images = [f"{o.name}/{i.name}" for o in organizations for i in o.iterdir()]
|
||||
organizations = [o.name for o in organizations]
|
||||
@ -654,7 +654,7 @@ def parse_args():
|
||||
nargs="+",
|
||||
default=images,
|
||||
choices=images,
|
||||
help="list of branches",
|
||||
help="list of images",
|
||||
)
|
||||
images_group.add_argument(
|
||||
"-o",
|
||||
|
1
org/alt/gitea/test
Normal file
1
org/alt/gitea/test
Normal file
@ -0,0 +1 @@
|
||||
TEST="gitea --version"
|
1
org/alt/python/test
Normal file
1
org/alt/python/test
Normal file
@ -0,0 +1 @@
|
||||
TEST="pyhon3 --help"
|
Loading…
Reference in New Issue
Block a user