diff --git a/.github/workflows/deploy-trigger.yml b/.github/workflows/deploy-trigger.yml new file mode 100644 index 0000000..ff6e606 --- /dev/null +++ b/.github/workflows/deploy-trigger.yml @@ -0,0 +1,28 @@ +name: Deploy to Production +on: + workflow_dispatch: + inputs: + confirm_deploy: + description: 'Type "deploy" to confirm' + required: true + default: '' + +jobs: + deploy: + runs-on: ubuntu-latest + if: github.event.inputs.confirm_deploy == 'deploy' + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Rebase prod to master and deploy + run: | + git config user.name "NedaaBot" + git config user.email "186649556+NedaaBot@users.noreply.github.com" + git switch master + git pull origin master + git switch prod + git rebase master + git push --force-with-lease origin prod diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6862850..99ff46e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,14 +1,11 @@ -name: Deploy Docker Image - +name: Build and Deploy on: push: branches: - - '**' - + - 'prod' env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} - jobs: build-and-push: runs-on: ubuntu-latest @@ -17,7 +14,6 @@ jobs: packages: write attestations: write id-token: write - steps: - name: Checkout uses: actions/checkout@v4 @@ -44,6 +40,10 @@ jobs: uses: docker/build-push-action@v6 with: context: . - push: ${{ github.ref == 'refs/heads/master' }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + - name: Trigger Deployment Update + run: | + curl -H "Authorization: Bearer ${{ secrets.DEPLOY_TOKEN }}" ${{ secrets.DEPLOY_ENDPOINT }}