Skip to content

Commit

Permalink
chore(build): updated deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dsebastien committed Oct 11, 2024
1 parent 24db6dc commit d344f12
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,12 @@ jobs:
with:
# Fetch all history for all tags and branches
fetch-depth: 0
# Checkout the main branch
ref: main

# Create and switch to a new branch based on the existing production branch before the deployment
# This is necessary because the production branch is protected
- run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git checkout main
git fetch origin
git switch --create deploy-${GITHUB_SHA} origin/production
git push --set-upstream origin deploy-${GITHUB_SHA}
git pull
NX_NO_CLOUD=true && git rebase origin/main
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Create and merge a PR for this deployment
# This is a workaround for the production branch protection
# Reference: https://github.com/krlmlr/pr-bots/blob/main/.github/workflows/write-file-branch-merge.yaml
- run: |
gh pr create --title "Deploy ${GITHUB_SHA}" --body "This is a Deployment PR" --base production --head deploy-${GITHUB_SHA}
gh pr create --title "Deploy ${GITHUB_SHA}" --body "This is a Deployment PR" --base production --head main
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -51,12 +34,3 @@ jobs:
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Clean up the temporary deployment branch
- run: |
git checkout main
git branch -D deploy-${GITHUB_SHA}
git push origin --delete deploy-${GITHUB_SHA}
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit d344f12

Please sign in to comment.