diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 7e54343201..8bdde138c9 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -4,7 +4,7 @@ on: # branches: # - kr-github-actions pull_request: - types: [opened, reopened, synchronize, edited] + types: [opened, reopened, synchronize, edited, closed] #schedule: # - cron: '0 0 * * *' # every day at midnight #workflow_dispatch: @@ -16,7 +16,7 @@ on: env: SHA: ${{github.event.pull_request.head.sha}} PROJECT: ${{github.event.pull_request.head.repo.name}} - BODY: ${{github.event.pull_request.body}} + CI_PR_BODY: ${{github.event.pull_request.body}} PACKAGE_URL: ${{github.event.pull_request.head.repo.ssh_url}} PACKAGE_BRANCH: ${{github.event.pull_request.head.ref}} #MY_GITHUB_TOKEN: ${{ secrets.GH_STATUS_TOKEN }} @@ -35,19 +35,23 @@ env: IMAGE_TAG1: $(echo "$CI_PROJECT-$CI_PACKAGE_BRANCH" | sed "s;/;-;g") GITHUB_COMMENT: ${{ secrets.GH_COMMENT }} pull_req_id: ${{github.event.pull_request.number}} +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: job1: - name: build-stm-image + name: build-stm-image + if: github.event.action != 'closed' runs-on: ubuntu-22.04 steps: - name: Export Params run: | + echo "Env Check: CI_PROJECT: $CI_PROJECT CI_PACKAGE_BRANCH: $CI_PACKAGE_BRANCH CI_PR_BODY: $CI_PR_BODY" echo "REPOSITORY=${{env.aws-url}}/enterprise" >> $GITHUB_ENV echo "TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV echo "IMAGE=${{env.aws-url}}/enterprise:${{env.IMAGE_TAG1}}" >> $GITHUB_ENV #Additional - echo "CI_PR_BODY=1" >> $GITHUB_ENV - echo "CACHEBUSTER=abc" >> $GITHUB_ENV + echo "CACHEBUSTER="$(date +%s) >> $GITHUB_ENV - name: Clone Repo STM run: | git clone --depth 1 -b cicd "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-stm-docker.git" pm4-stm-docker @@ -64,13 +68,13 @@ jobs: - name: Build and Push the image to ECR run: | cd pm4-stm-docker - docker stop $(docker ps -a -q) || true docker container prune -f docker-compose down -v docker-compose build processmaker docker push ${IMAGE} job2: name: deploy-stm + if: github.event.action != 'closed' needs: job1 runs-on: ubuntu-22.04 container: @@ -79,6 +83,7 @@ jobs: steps: - name: Export Params run: | + echo "Env Check: CI_PROJECT: $CI_PROJECT CI_PACKAGE_BRANCH: $CI_PACKAGE_BRANCH CI_PR_BODY: $CI_PR_BODY" echo "REPOSITORY=${{env.aws-url}}/enterprise" >> $GITHUB_ENV echo "TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV echo "IMAGE_TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV @@ -117,6 +122,7 @@ jobs: bash ./github_comment.sh "$PROJECT" "$pull_req_id" job3: name: run-phpunit + if: github.event.action != 'closed' needs: job1 runs-on: ubuntu-22.04 steps: