Deploy #296
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
# run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
deploy_target: | |
description: "Deploy Target" | |
required: true | |
default: "tokamak.oli.cmu.edu" | |
type: choice | |
options: | |
- tokamak.oli.cmu.edu | |
- stellarator.oli.cmu.edu | |
- heliotron.oli.cmu.edu | |
- loadtest.oli.cmu.edu | |
- proton.oli.cmu.edu | |
# disable auto deploy on tag for now | |
# push: | |
# tags: | |
# - 'v[0-9]+.[0-9]+.[0-9]+' # production release tags vX.Y.Z | |
# - 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' # release candidate tags vX.Y.Z-rc1 | |
# | |
jobs: | |
deployment: | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ github.event.inputs.deploy_target }} | |
url: https://${{ github.event.inputs.deploy_target }} | |
outputs: | |
app_version: ${{ steps.info.outputs.app_version }} | |
sha_short: ${{ steps.info.outputs.sha_short }} | |
steps: | |
- name: 🛎️ Checkout | |
uses: actions/checkout@v2 | |
- name: 🧾 Build info | |
id: info | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
echo "app_version=$(cat mix.exs | grep version | sed -e 's/.*version: "\(.*\)",/\1/')" >> $GITHUB_OUTPUT | |
- run: echo "deploying ${{ github.sha }} ${{ github.ref }} ${{ github.ref_name }} to ${{ github.event.inputs.deploy_target }}" | |
- name: 🚢💰 Deploy using SSH | |
uses: fifsky/ssh-action@master | |
with: | |
command: | | |
cd /torus | |
sh deploy.sh -r ${{ github.ref }} ${{ steps.info.outputs.app_version }} ${{ steps.info.outputs.sha_short }} | |
host: ${{ github.event.inputs.deploy_target }} | |
user: simon-bot | |
key: ${{ secrets.SIMON_BOT_PRIVATE_KEY}} | |
port: 44067 |