-
-
Notifications
You must be signed in to change notification settings - Fork 54
92 lines (80 loc) · 3.31 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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
jobs:
deploy:
environment: secrets
if: ${{ github.event.issue.pull_request }} # only run on pull request comments
runs-on: ubuntu-latest
steps:
- uses: github/[email protected]
id: branch-deploy
with:
admins: the-hideout/core-contributors
admins_pat: ${{ secrets.BRANCH_DEPLOY_ADMINS_PAT }}
skip_ci: development
skip_reviews: development
environment_targets: production,development
environment_urls: production|https://tarkov.dev,development|disabled
sticky_locks: "true"
- name: checkout
if: ${{ steps.branch-deploy.outputs.continue == 'true' }}
uses: actions/[email protected]
with:
ref: ${{ steps.branch-deploy.outputs.ref }}
- uses: actions/[email protected]
if: ${{ steps.branch-deploy.outputs.continue == 'true' }}
with:
node-version-file: .node-version
cache: 'npm'
- name: install dependencies
if: ${{ steps.branch-deploy.outputs.continue == 'true' }}
run: npm ci
- name: build
if: ${{ steps.branch-deploy.outputs.continue == 'true' }}
run: npm run build
env:
GITHUB_TOKEN: ${{ secrets.HIDEOUT_BOT_TOKEN }}
# deploy to the dev env and also save the stdout to a file
- name: deploy - dev
id: dev-deploy
if: ${{ steps.branch-deploy.outputs.continue == 'true' &&
steps.branch-deploy.outputs.noop != 'true' &&
steps.branch-deploy.outputs.environment == 'development' }}
uses: cloudflare/wrangler-action@f84a562284fc78278ff9052435d9526f9c718361 # [email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
wranglerVersion: '2.13.0'
command: pages publish build/ --project-name=tarkov-dev --branch=preview
# fetch the dev url from stdout and save add it to the deploy message
- name: add development url to deploy message
if: ${{ steps.branch-deploy.outputs.continue == 'true' &&
steps.branch-deploy.outputs.noop != 'true' &&
steps.branch-deploy.outputs.environment == 'development' }}
env:
DEPLOYMENT_URL: ${{ steps.dev-deploy.outputs.deployment-url }}
CMD_OUTPUT: ${{ steps.dev-deploy.outputs.command-output }}
run: |
echo "for debugging (cmd output): ${CMD_OUTPUT}"
echo ""
echo "DEPLOY_MESSAGE=${DEPLOYMENT_URL}" >> $GITHUB_ENV
echo "DEPLOY_MESSAGE=${DEPLOYMENT_URL}"
- name: deploy - prod
id: prod-deploy
if: ${{ steps.branch-deploy.outputs.continue == 'true' &&
steps.branch-deploy.outputs.noop != 'true' &&
steps.branch-deploy.outputs.environment == 'production' }}
uses: cloudflare/wrangler-action@f84a562284fc78278ff9052435d9526f9c718361 # [email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
wranglerVersion: '2.13.0'
command: pages publish build/ --project-name=tarkov-dev --branch=main