add being able to use verdaccio / proxy #88
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Push & build images on each commit | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| environment: registry | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Log in | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ secrets.REGISTRY_USERNAME }} | |
| password: ${{ secrets.REGISTRY_PASSWORD }} | |
| - name: Build and push images | |
| run: | | |
| ls -lah | |
| changed_dirs=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | cut -d/ -f1 | sort -u) | |
| for dir in $changed_dirs; do | |
| repo_name=$(basename "$dir") | |
| if [[ "$repo_name" == bootc-* ]]; then | |
| echo "Skipping $repo_name: Ignored by pattern" | |
| continue | |
| fi | |
| if [ -d "$dir" ]; then | |
| if [ -f "$dir/Containerfile" ]; then | |
| echo "Building and pushing $repo_name" | |
| cd $dir | |
| docker build --platform linux/amd64 \ | |
| -t ghcr.io/${{ secrets.REGISTRY_USERNAME }}/${repo_name} \ | |
| --label "org.opencontainers.image.source=https://github.com/cdrage/containerfiles" \ | |
| -f Containerfile . | |
| docker push ghcr.io/${{ secrets.REGISTRY_USERNAME }}/${repo_name} | |
| cd .. | |
| else | |
| echo "Skipping $repo_name: No Containerfile found" | |
| fi | |
| else | |
| echo "Skipping $dir: Not a directory" | |
| fi | |
| done |