Skip to content

chore(release): Test v7.37.7 #59

chore(release): Test v7.37.7

chore(release): Test v7.37.7 #59

name: Release to Production
on:
pull_request:
branches:
- production
types: [closed]
jobs:
release:
if: ${{ github.event.pull_request.merged == true }}
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get Job ID from PR
run: |
cat > BODY <<'EOF'
${{ github.event.pull_request.body}}
EOF
JOB_ID=$(cat BODY | perl -ne 'print "$1\n" and exit if m/Production Job Id:\s(\w+)/;')
echo "JOB_ID=${JOB_ID}" >> $GITHUB_ENV
- name: Push to Production Server
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 100
retry_wait_seconds: 5
# If the job isn't created yet, will return {"message":"400 Bad request - Unplayable Job"}
command: |
RES=$(curl "https://gitlab.com/api/v4/projects/${{ vars.GITLAB_PROJECT_ID }}/jobs/${{ env.JOB_ID }}/play" \
--request POST \
--header 'PRIVATE-TOKEN: ${{ secrets.GITLAB_DEPLOYMENT_ACCESS_TOKEN }}')
echo $RES
JOB_ID_DONE=$(echo $RES | jq '.id // empty')
[ -z "$JOB_ID_DONE" ] && exit 1 || exit 0
- name: Poll Production Release
uses: artiz/poll-endpoint@1.0.2
with:
url: https://gitlab.com/api/v4/projects/${{ vars.GITLAB_PROJECT_ID }}/jobs/${{ env.JOB_ID }}?access_token=${{ secrets.GITLAB_DEPLOYMENT_ACCESS_TOKEN }}
method: GET
expect-status: 200
expect-response-regex: '"status":"success"'
timeout: 120000
interval: 3000
- name: Report Status
if: failure()
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GH_ACTIONS_NOTIFICATIONS }}