ci: extract build + push actions
This commit is contained in:
parent
61a2f68098
commit
b0a431620e
3 changed files with 4 additions and 44 deletions
|
@ -1,11 +0,0 @@
|
||||||
name: Build Container Images
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Setup Spud
|
|
||||||
uses: https://forge.karnov.club/spadinastan/setup-spud-action@feat/install-spud-in-env
|
|
||||||
- name: Build images
|
|
||||||
run: |
|
|
||||||
spud build -d ./service.yml
|
|
||||||
podman image ls
|
|
|
@ -18,8 +18,10 @@ jobs:
|
||||||
runs-on: imagefactory-latest
|
runs-on: imagefactory-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: ./.forgejo/workflows/build-images-action
|
- uses: https://forge.karnov.club/spadinastan/build-container-images-action@main
|
||||||
- uses: ./.forgejo/workflows/push-images
|
with:
|
||||||
|
service-definition: ./service.yml
|
||||||
|
- uses: https://forge.karnov.club/spadinastan/push-container-images-action@main
|
||||||
with:
|
with:
|
||||||
image-prefix: sesame
|
image-prefix: sesame
|
||||||
registry-user: ${{ secrets.REGISTRY_USER }}
|
registry-user: ${{ secrets.REGISTRY_USER }}
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
name: Push Container Images
|
|
||||||
inputs:
|
|
||||||
image-prefix:
|
|
||||||
required: true
|
|
||||||
registry-user:
|
|
||||||
required: true
|
|
||||||
registry-token:
|
|
||||||
required: true
|
|
||||||
registry-endpoint:
|
|
||||||
required: true
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- name: Login to Registry
|
|
||||||
run: podman login -u ${{ inputs.registry-user }} -p ${{ inputs.registry-token }} ${{ inputs.registry-endpoint }}
|
|
||||||
- name: Set image metadata
|
|
||||||
id: image-metadata
|
|
||||||
run: |
|
|
||||||
echo "image-tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
||||||
- name: Push tagged images to registry
|
|
||||||
run: |
|
|
||||||
for image in $(podman image ls --format {{.Repository}} | grep localhost/${{ inputs.image-prefix }})
|
|
||||||
do
|
|
||||||
for tag in latest ${{ steps.image-metadata.outputs.image-tag }} ${{ github.ref_name }}
|
|
||||||
do
|
|
||||||
SRC=$image:latest
|
|
||||||
DEST=${{ inputs.registry-endpoint }}/$image:$tag
|
|
||||||
echo "Pushing $SRC to $DEST"
|
|
||||||
podman push $SRC $DEST
|
|
||||||
done
|
|
||||||
done
|
|
Loading…
Reference in a new issue