image-built #598
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: CI/CD | |
on: | |
push: | |
branches: ['main'] | |
paths-ignore: | |
- docker-compose.prod.yml | |
- .github/** | |
- README.md | |
workflow_dispatch: | |
repository_dispatch: | |
types: | |
- image-built | |
concurrency: | |
group: ci-cd | |
cancel-in-progress: true | |
jobs: | |
make-docker-compose-prod: | |
name: Make docker-compose.prod.yml | |
runs-on: ubuntu-latest | |
outputs: | |
change_detected: ${{ steps.detect-changes.outputs.change_detected }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: frenck/action-setup-yq@v1 | |
- uses: imjasonh/[email protected] | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CONTAINER_REGISTRY_READ_TOKEN }} | |
- name: Make docker-compose.prod.yml | |
run: ./bin/make-docker-compose-prod.sh | |
- name: Detect changes in docker-compose.prod.yml | |
id: detect-changes | |
run: git diff --name-status docker-compose.prod.yml | grep docker-compose.prod.yml && echo "change_detected=1" >> $GITHUB_OUTPUT || echo "No changes" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: docker-compose.prod.yml | |
path: docker-compose.prod.yml | |
integration-test: | |
needs: make-docker-compose-prod | |
if: ${{ needs.make-docker-compose-prod.outputs.change_detected }} | |
uses: ./.github/workflows/integration-test.yaml | |
secrets: inherit | |
commit-docker-compose-prod: | |
name: Commit docker-compose.prod.yml | |
runs-on: ubuntu-latest | |
needs: | |
- integration-test | |
- make-docker-compose-prod | |
concurrency: | |
group: git-commit | |
cancel-in-progress: false | |
if: ${{ needs.make-docker-compose-prod.outputs.change_detected }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref_name }} | |
token: ${{ secrets.TOKEN_TO_RUN_GITHUB_ACTION }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose.prod.yml | |
- name: Rebuild Readme | |
run: ./bin/build-combined-readme.sh | |
- name: Set current date | |
id: date | |
run: echo "NOW=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT | |
- name: Commit report | |
run: | | |
git config --global user.name '${{ github.actor }}' | |
git config --global user.email '${{ github.actor }}@users.noreply.github.com' | |
git add docker-compose.prod.yml README.md | |
git commit -m "Updated docker-compose.prod.yml - ${{ steps.date.outputs.NOW }}" | |
git tag -d stable || true | |
git tag -a stable -m "Updated docker-compose.prod.yml - ${{ steps.date.outputs.NOW }}" | |
git push | |
git push --tags --force |