From b0a431620ee0fde788a136ddc5c07a0b2cf589ab Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Thu, 7 Nov 2024 22:34:19 -0500 Subject: [PATCH] ci: extract build + push actions --- .../workflows/build-images-action/action.yml | 11 ------- .forgejo/workflows/build-images.yml | 6 ++-- .forgejo/workflows/push-images/action.yml | 31 ------------------- 3 files changed, 4 insertions(+), 44 deletions(-) delete mode 100644 .forgejo/workflows/build-images-action/action.yml delete mode 100644 .forgejo/workflows/push-images/action.yml diff --git a/.forgejo/workflows/build-images-action/action.yml b/.forgejo/workflows/build-images-action/action.yml deleted file mode 100644 index 0f56f06..0000000 --- a/.forgejo/workflows/build-images-action/action.yml +++ /dev/null @@ -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 diff --git a/.forgejo/workflows/build-images.yml b/.forgejo/workflows/build-images.yml index ae39b8e..4264a1d 100644 --- a/.forgejo/workflows/build-images.yml +++ b/.forgejo/workflows/build-images.yml @@ -18,8 +18,10 @@ jobs: runs-on: imagefactory-latest steps: - uses: actions/checkout@v4 - - uses: ./.forgejo/workflows/build-images-action - - uses: ./.forgejo/workflows/push-images + - uses: https://forge.karnov.club/spadinastan/build-container-images-action@main + with: + service-definition: ./service.yml + - uses: https://forge.karnov.club/spadinastan/push-container-images-action@main with: image-prefix: sesame registry-user: ${{ secrets.REGISTRY_USER }} diff --git a/.forgejo/workflows/push-images/action.yml b/.forgejo/workflows/push-images/action.yml deleted file mode 100644 index f1ca7df..0000000 --- a/.forgejo/workflows/push-images/action.yml +++ /dev/null @@ -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