ci: remove push redundant calls
All checks were successful
/ pre-run (push) Successful in 24s
/ post-run (push) Successful in 27s
/ build (push) Successful in 2m3s

This commit is contained in:
Marc 2024-11-07 19:54:05 -05:00
parent a2ae3abdf8
commit 61a2f68098
Signed by: marc
GPG key ID: 048E042F22B5DC79
3 changed files with 33 additions and 28 deletions

View file

@ -1,39 +1,11 @@
name: Build Container Images name: Build Container Images
inputs:
image-prefix:
required: true
registry-user:
required: true
registry-token:
required: true
registry-endpoint:
required: true
runs: runs:
using: composite using: composite
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup Spud - name: Setup Spud
uses: https://forge.karnov.club/spadinastan/setup-spud-action@feat/install-spud-in-env uses: https://forge.karnov.club/spadinastan/setup-spud-action@feat/install-spud-in-env
- 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: Build images - name: Build images
run: | run: |
spud build -d ./service.yml spud build -d ./service.yml
podman image ls podman image ls
- name: Push tagged images to registry
if: ${{ github.event_name == 'push' }}
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=${{ vars.REGISTRY_ENDPOINT }}/$image:$tag
echo "Pushing $SRC to $DEST"
podman push $SRC $DEST
done
done

View file

@ -17,7 +17,9 @@ jobs:
needs: [pre-run] needs: [pre-run]
runs-on: imagefactory-latest runs-on: imagefactory-latest
steps: steps:
- uses: actions/checkout@v4
- uses: ./.forgejo/workflows/build-images-action - uses: ./.forgejo/workflows/build-images-action
- uses: ./.forgejo/workflows/push-images
with: with:
image-prefix: sesame image-prefix: sesame
registry-user: ${{ secrets.REGISTRY_USER }} registry-user: ${{ secrets.REGISTRY_USER }}

View file

@ -0,0 +1,31 @@
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