From e53c67915561cad5a2d0b2a48e598ecb81177f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Vidal?= Date: Thu, 6 Jun 2024 12:34:48 -0300 Subject: [PATCH] Simplify deploy script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrés Vidal --- .github/workflows/deploy-to-ifrs.yml | 34 +++++----------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/.github/workflows/deploy-to-ifrs.yml b/.github/workflows/deploy-to-ifrs.yml index 1d980073..f4d50df4 100644 --- a/.github/workflows/deploy-to-ifrs.yml +++ b/.github/workflows/deploy-to-ifrs.yml @@ -25,21 +25,10 @@ jobs: - run: git subtree split -P frontend -b stage-release - run: git checkout stage-release # Squashes the whole branch into a single temporary commit - - run: git reset --soft $(git rev-list --max-parents=0 stage-release) - - run: git commit --amend -m "Temporary Commit" - # Generates a diff between the current branch and the IFRS remote - - run: git diff ifrs-frontend/stage > changes.diff - # Rebases the current branch with the IFRS remote to ensure fast-forward merge in the IFRS remote - - run: git pull --rebase ifrs-frontend stage -X theirs - run: git reset --soft ifrs-frontend/stage - # Applies the diff generated before, so deletions are kept - - run: git apply --reject changes.diff || echo "Patch partially applied with .rej files generated." && cat *.rej - - run: git add . -A - # Ommits files that must not be synced with the ones in the IFRS remote - - run: git restore --staged .gitignore Dockerfile .dockerignore .gitlab-ci.yml .ci '*rej' '*diff' '*gitkeep' - # Commits and push a single release commit - - run: git status - - run: git commit --amend -m "Release to Stage `TZ=America/Sao_Paulo date '+%d %b %Y %T São Paulo (UTC%Z)'`" + - run: git add -A + - run: git restore --staged .gitignore Dockerfile .dockerignore .gitlab-ci.yml .ci '*gitkeep' + - run: git diff-index --quiet HEAD || git commit -m "Release to Stage `TZ=America/Sao_Paulo date '+%d %b %Y %T São Paulo (UTC%Z)'`" - run: git push -f ifrs-frontend stage-release DeployBackend: @@ -63,19 +52,8 @@ jobs: - run: git subtree split -P backend -b stage-release - run: git checkout stage-release # Squashes the whole branch into a single temporary commit - - run: git reset --soft $(git rev-list --max-parents=0 stage-release) - - run: git commit --amend -m "Temporary Commit" - # Generates a diff between the current branch and the IFRS remote - - run: git diff ifrs-backend/stage > changes.diff - # Rebases the current branch with the IFRS remote to ensure fast-forward merge in the IFRS remote - - run: git pull --rebase ifrs-backend stage -X theirs - run: git reset --soft ifrs-backend/stage - # Applies the diff generated before, so deletions are kept - - run: git apply --reject changes.diff || echo "Patch partially applied with .rej files generated." && cat *.rej - - run: git add . -A - # Ommits files that must not be synced with the ones in the IFRS remote - - run: git restore --staged .gitignore Dockerfile .dockerignore .gitlab-ci.yml .ci '*rej' '*diff' '*gitkeep' - # Commits and push a single release commit - - run: git status - - run: git commit --amend -m "Release to Stage `TZ=America/Sao_Paulo date '+%d %b %Y %T São Paulo (UTC%Z)'`" + - run: git add -A + - run: git restore --staged .gitignore Dockerfile .dockerignore .gitlab-ci.yml .ci '*gitkeep' + - run: git diff-index --quiet HEAD || git commit -m "Release to Stage `TZ=America/Sao_Paulo date '+%d %b %Y %T São Paulo (UTC%Z)'`" --allow-empty - run: git push -f ifrs-backend stage-release