Skip to content

Updating iteration condition #3

Updating iteration condition

Updating iteration condition #3

name: Publish packages
on:
push:
branches:
- main
workflow_dispatch:
jobs:
publish-packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Carvel tools
shell: bash
run: curl -L https://carvel.dev/install.sh | bash
- name: vendir sync
run: vendir sync
# - name: Calculate variables
# shell: bash
# run: |
# REPOSITORY_OWNER=${{github.repository_owner}}
# echo "REPOSITORY_OWNER=${REPOSITORY_OWNER,,}" >>${GITHUB_ENV}
# echo "REPOSITORY_TAG=${GITHUB_REF##*/}" >>${GITHUB_ENV}
# echo "REPOSITORY_SHA_TAG=sha-${GITHUB_SHA::7}" >>${GITHUB_ENV}
- name: Iterate over directories
run: |
IFS=$'\n' DIRS=( $(find packages -type d -mindepth 2 -maxdepth 2 -print) )
for DIR in ${DIRS[@]}; do
PACKAGE=$(echo $DIR | awk -F"/" '{ print $(NF-1)":"$NF }')
echo "Pushing package $PACKAGE from $DIR into ghcr.io/${{github.repository}}/$PACKAGE"
imgpkg push -i ghcr.io/${{github.repository}}/$PACKAGE -f $DIR --registry-username=${{github.actor}} --registry-password=${{secrets.GITHUB_TOKEN}}
done