Skip to content

Combined PRs

Combined PRs #1641

Workflow file for this run

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/branch-deploy@v8.1.0
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/checkout@v4.1.1
with:
ref: ${{ steps.branch-deploy.outputs.ref }}
- uses: actions/setup-node@v3.8.1
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@5e8484995321734668f14981c316aa9188d76ed1 # pin@3.3.2
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 | tee output.txt
# 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' }}
run: |
dev_url=$(cat output.txt | grep 'Deployment complete! Take a peek over at' | awk '{print $NF}')
dev_url=$(echo $dev_url | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
echo "DEPLOY_MESSAGE=${dev_url}" >> $GITHUB_ENV
echo "DEPLOY_MESSAGE=${dev_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@5e8484995321734668f14981c316aa9188d76ed1 # pin@3.3.2
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