integration testing with mergify #69
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 Image CI | |
on: | |
pull_request: | |
types: | |
- synchronize | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
- name: Build the Docker image | |
run: | | |
docker build . --file ./Dockerfile --tag ghcr.io/eol-uchile/docs-eol:${GITHUB_SHA} | |
docker login ghcr.io -u eolito -p ${{ secrets.CR_PAT }} | |
docker push ghcr.io/eol-uchile/docs-eol:${GITHUB_SHA} | |
- name: Create or update PR to main | |
if: github.ref != 'refs/heads/main' | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "actions@github.com" | |
git checkout -b update-image-${GITHUB_SHA} | |
git add . | |
# Verificar si hay cambios para evitar PRs vacíos | |
if ! git diff-index --quiet HEAD --; then | |
git commit -m "Update Docker image" | |
git push origin update-image-${GITHUB_SHA} | |
else | |
echo "No changes to commit or push." | |
fi |