Skip to content

Commit

Permalink
Frist draft of CD pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
rainx0r committed Jul 3, 2023
1 parent 2d0815a commit 5f211b5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and publish Docker images

on:
push:
paths:
- "*/**"

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish Docker images
run: |
for dir in */; do
if [ -n "$(git diff --name-only HEAD^ HEAD -- "$dir")" ]; then
docker build -t ghcr.io/${{ github.repository_owner }}/${dir%/}:${{ github.sha }} $dir
docker push ghcr.io/${{ github.repository_owner }}/${dir%/}:${{ github.sha }}
fi
done

0 comments on commit 5f211b5

Please sign in to comment.