Merge pull request #139 from getwilds/gtf-smash #72
This file contains 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: Docker Build and Upload CI | |
on: | |
push: | |
branches: | |
- 'main' | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
id: files | |
uses: jitterbit/get-changed-files@v1 | |
- | |
name: Build and Push | |
run: | | |
for changed_file in ${{ steps.files.outputs.added_modified }}; do | |
if [[ $changed_file == *"Dockerfile_"* ]]; then | |
IFS="/" read -ra toolarr <<< "$changed_file" | |
IFS="_" read -ra tagarr <<< "$changed_file" | |
docker build --platform linux/amd64 -t ghcr.io/getwilds/${toolarr[0]}:${tagarr[-1]} -f ${changed_file} --push . | |
docker system prune -af | |
sleep 5 | |
fi | |
done | |
- | |
name: Login to DockerHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PW }} | |
- | |
name: Build and Push | |
run: | | |
for changed_file in ${{ steps.files.outputs.added_modified }}; do | |
if [[ $changed_file == *"Dockerfile_"* ]]; then | |
IFS="/" read -ra toolarr <<< "$changed_file" | |
IFS="_" read -ra tagarr <<< "$changed_file" | |
docker build --platform linux/amd64 -t getwilds/${toolarr[0]}:${tagarr[-1]} -f ${changed_file} --push . | |
docker system prune -af | |
sleep 5 | |
fi | |
done | |