diff --git a/.github/workflows/deploy-backend-production.yml b/.github/workflows/deploy-backend-production.yml new file mode 100644 index 0000000000..898d4f028a --- /dev/null +++ b/.github/workflows/deploy-backend-production.yml @@ -0,0 +1,48 @@ +name: Production Deploy (Backend) + +on: + workflow_run: + workflows: [CI] + types: [completed] + branches: [release] + workflow_dispatch: # manual trigger + +jobs: + # runs if CI workflow was successful OR if this was manually triggered + on-success: + runs-on: ubuntu-latest + if: > + github.event_name == 'workflow_dispatch' || + github.event.workflow_run.conclusion == 'success' + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + with: + ref: release + + - name: Set VERSION + run: echo "VERSION=$(./scripts/get_version.sh)" >> $GITHUB_ENV + + - name: Write commit SHA to file + run: echo $GITHUB_SHA > frontends/main/public/hash.txt + + - name: Heroku login + env: + HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} + run: heroku container:login + + - name: Release Backend on Heroku + uses: akhileshns/heroku-deploy@581dd286c962b6972d427fcf8980f60755c15520 + with: + heroku_api_key: ${{ secrets.HEROKU_API_KEY }} + heroku_app_name: mitopen-production + heroku_email: ${{ secrets.HEROKU_EMAIL }} + branch: release + + # runs ONLY on a failure of the CI workflow + on-failure: + runs-on: ubuntu-latest + if: > + github.event_name == 'workflow_dispatch' || + github.event.workflow_run.conclusion == 'failure' + steps: + - run: echo 'The triggering workflow failed' diff --git a/.github/workflows/deploy-backend-release-candidate.yml b/.github/workflows/deploy-backend-release-candidate.yml new file mode 100644 index 0000000000..50678fb752 --- /dev/null +++ b/.github/workflows/deploy-backend-release-candidate.yml @@ -0,0 +1,48 @@ +name: Release Candidate Deploy (Backend) + +on: + workflow_run: + workflows: [CI] + types: [completed] + branches: [release-candidate] + workflow_dispatch: # manual trigger + +jobs: + # runs if CI workflow was successful OR if this was manually triggered + on-success: + runs-on: ubuntu-latest + if: > + github.event_name == 'workflow_dispatch' || + github.event.workflow_run.conclusion == 'success' + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + with: + ref: release-candidate + + - name: Set VERSION + run: echo "VERSION=$(./scripts/get_version.sh)" >> $GITHUB_ENV + + - name: Write commit SHA to file + run: echo $GITHUB_SHA > frontends/main/public/hash.txt + + - name: Heroku login + env: + HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} + run: heroku container:login + + - name: Release Backend on Heroku + uses: akhileshns/heroku-deploy@581dd286c962b6972d427fcf8980f60755c15520 + with: + heroku_api_key: ${{ secrets.HEROKU_API_KEY }} + heroku_app_name: mitopen-rc + heroku_email: ${{ secrets.HEROKU_EMAIL }} + branch: release-candidate + + # runs ONLY on a failure of the CI workflow + on-failure: + runs-on: ubuntu-latest + if: > + github.event_name == 'workflow_dispatch' || + github.event.workflow_run.conclusion == 'failure' + steps: + - run: echo 'The triggering workflow failed' diff --git a/.github/workflows/production.yml b/.github/workflows/deploy-frontend-production.yml similarity index 88% rename from .github/workflows/production.yml rename to .github/workflows/deploy-frontend-production.yml index 248d3932e2..d1c04b211e 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/deploy-frontend-production.yml @@ -1,4 +1,4 @@ -name: Production Deploy +name: Production Deploy (Frontend) on: workflow_run: @@ -25,19 +25,6 @@ jobs: - name: Write commit SHA to file run: echo $GITHUB_SHA > frontends/main/public/hash.txt - - name: Heroku login - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - run: heroku container:login - - - name: Release Backend on Heroku - uses: akhileshns/heroku-deploy@581dd286c962b6972d427fcf8980f60755c15520 - with: - heroku_api_key: ${{ secrets.HEROKU_API_KEY }} - heroku_app_name: mitopen-production - heroku_email: ${{ secrets.HEROKU_EMAIL }} - branch: release - - name: Build and push the Docker image env: HEROKU_APP_NAME: mitopen-production-nextjs diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/deploy-frontend-release-candidate.yml similarity index 88% rename from .github/workflows/release-candidate.yml rename to .github/workflows/deploy-frontend-release-candidate.yml index c32c06ac33..0d24005c65 100644 --- a/.github/workflows/release-candidate.yml +++ b/.github/workflows/deploy-frontend-release-candidate.yml @@ -1,4 +1,4 @@ -name: Release Candidate Deploy +name: Release Candidate Deploy (Frontend) on: workflow_run: @@ -25,19 +25,6 @@ jobs: - name: Write commit SHA to file run: echo $GITHUB_SHA > frontends/main/public/hash.txt - - name: Heroku login - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - run: heroku container:login - - - name: Release Backend on Heroku - uses: akhileshns/heroku-deploy@581dd286c962b6972d427fcf8980f60755c15520 - with: - heroku_api_key: ${{ secrets.HEROKU_API_KEY }} - heroku_app_name: mitopen-rc - heroku_email: ${{ secrets.HEROKU_EMAIL }} - branch: release-candidate - - name: Build and push the Docker image env: HEROKU_APP_NAME: mitopen-rc-nextjs