Skip to content

[TESTING-ARGENTINA-HOSTCOLOR] Deploy to Argentina Arena Testing HostColor #14

[TESTING-ARGENTINA-HOSTCOLOR] Deploy to Argentina Arena Testing HostColor

[TESTING-ARGENTINA-HOSTCOLOR] Deploy to Argentina Arena Testing HostColor #14

name: "[TESTING-ARGENTINA-HOSTCOLOR] Deploy to Argentina Arena Testing HostColor"
on:
workflow_dispatch:
jobs:
build-deploy:
name: Build and deploy to Argentina Testing HostColor
runs-on: ubuntu-latest
environment:
name: testing-argentina
steps:
- uses: actions/checkout@v4
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: Add host keys
env:
SSH_HOST: ${{ vars.TS_ARENA_HOST_HOSTCOLOR }}
run: |
set -ex
mkdir -p ~/.ssh
retries=5; until ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done
- name: Copy deploy script
env:
SSH_USERNAME: dev
SSH_HOST: ${{ vars.TS_ARENA_HOST_HOSTCOLOR }}
run: |
set -ex
rsync --mkpath --delete -avz devops/deploy.sh ${SSH_USERNAME}@${SSH_HOST}:/home/${SSH_USERNAME}/deploy-script/
- name: Execute deploy script
env:
SSH_HOST: ${{ vars.TS_ARENA_HOST_HOSTCOLOR }}
SSH_USERNAME: dev
MIX_ENV: ${{ vars.MIX_ENV }}
RELEASE: arena
PHX_SERVER: ${{ vars.PHX_SERVER }}
PHX_HOST: ${{ vars.HOST_HOSTCOLOR }}
PORT: ${{ vars.ARENA_PORT }}
GATEWAY_URL: ${{ vars.GATEWAY_URL }}
BOT_MANAGER_PORT: ${{ vars.BOT_MANAGER_PORT }}
BOT_MANAGER_HOST: ${{ vars.BOT_MANAGER_HOST }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
NEWRELIC_APP_NAME: ${{ vars.NEWRELIC_APP_NAME_HOSTCOLOR }}
NEWRELIC_KEY: ${{ secrets.NEWRELIC_KEY }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
XDG_RUNTIME_DIR: ${{ vars.XDG_RUNTIME_DIR }}
DBUS_SESSION_BUS_ADDRESS: ${{ vars.DBUS_SESSION_BUS_ADDRESS }}
run: |
set -ex
ssh ${SSH_USERNAME}@${SSH_HOST} \
BRANCH_NAME=${BRANCH_NAME} \
MIX_ENV=${MIX_ENV} \
RELEASE=${RELEASE} \
PHX_SERVER=${PHX_SERVER} \
PHX_HOST=${PHX_HOST} \
BOT_MANAGER_HOST=${BOT_MANAGER_HOST} \
PORT=${PORT} \
GATEWAY_URL=${GATEWAY_URL} \
BOT_MANAGER_PORT=${BOT_MANAGER_PORT} \
DATABASE_URL=${DATABASE_URL} \
SECRET_KEY_BASE=${SECRET_KEY_BASE} \
NEWRELIC_APP_NAME=${NEWRELIC_APP_NAME} \
NEWRELIC_KEY=${NEWRELIC_KEY} \
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} \
DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS} \
/home/${SSH_USERNAME}/deploy-script/deploy.sh
- name: Set Release Version from Tag
env:
TZ: "America/Argentina/Buenos_Aires"
run: echo "RELEASE_VERSION=$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_ENV
- name: New Relic Application Deployment Marker
uses: newrelic/[email protected]
with:
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
guid: ${{ secrets.NEW_RELIC_DEPLOYMENT_ENTITY_GUID }}
version: "${{ env.RELEASE_VERSION }}"
user: "${{ github.actor }}"