-
Notifications
You must be signed in to change notification settings - Fork 11
60 lines (52 loc) · 2.2 KB
/
branch-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: branch-deploy
on:
issue_comment:
types: [created]
# Permissions needed for reacting and adding comments for IssueOps commands
permissions:
pull-requests: write
deployments: write
contents: write
checks: read
statuses: read
jobs:
branch-deploy:
name: branch-deploy
if: # only run on pull request comments and very specific comment body string as defined in our branch-deploy settings
${{ github.event.issue.pull_request &&
(startsWith(github.event.comment.body, '.deploy') ||
startsWith(github.event.comment.body, '.noop') ||
startsWith(github.event.comment.body, '.lock') ||
startsWith(github.event.comment.body, '.help') ||
startsWith(github.event.comment.body, '.wcid') ||
startsWith(github.event.comment.body, '.unlock')) }}
runs-on: ubuntu-latest
steps:
- name: branch-deploy
id: branch-deploy
uses: github/branch-deploy@v9
with:
trigger: ".deploy"
environment: "production"
sticky_locks: "true" # https://github.com/github/branch-deploy/blob/1f6516ef5092890ce75d9e97ca7cbdb628e38bdd/docs/hubot-style-deployment-locks.md
allow_forks: "false"
# Check out the exact commit SHA from the output of the IssueOps command
- uses: actions/checkout@v4
if: ${{ steps.branch-deploy.outputs.continue == 'true' }}
with:
ref: ${{ steps.branch-deploy.outputs.sha }}
- uses: ruby/setup-ruby@d4526a55538b775af234ba4af27118ed6f8f6677 # [email protected]
if: ${{ steps.branch-deploy.outputs.continue == 'true' }}
with:
bundler-cache: true
- name: bootstrap
if: ${{ steps.branch-deploy.outputs.continue == 'true' }}
run: script/bootstrap
# Here we run a deploy. It is "gated" by the IssueOps logic and will only run if the outputs from our branch-deploy step indicate that the workflow should continue
- name: deploy
if: ${{ steps.branch-deploy.outputs.continue == 'true' && steps.branch-deploy.outputs.noop != 'true' }}
run: |
set -o pipefail
script/deploy | tee deploy.out
bundle exec ruby script/ci/render_deploy_message.rb
rm deploy.out