This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
FCE 209 faro logs (#84) #57
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: Staging Build and Deploy | |
on: | |
push: | |
branches: | |
- "main" | |
env: | |
DOMAIN: room.fishjam.work | |
BE_HOST: server.room.fishjam.work | |
PROJECT: staging | |
COMPOSE_FILE_NAME: docker-compose-deploy.yaml | |
jobs: | |
deploy1: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set versions | |
id: versions | |
run: | | |
cat << EOF >> $GITHUB_OUTPUT | |
fishjam_room=${GITHUB_SHA:0:7} | |
fishjam=$(cat .fishjam-version) | |
EOF | |
- name: Prepare .env file for the deployment | |
id: variables_population | |
run: | | |
echo "DOMAIN=${{env.DOMAIN}} | |
GF_SECURITY_ADMIN_PASSWORD=${{secrets.GF_SECURITY_ADMIN_PASSWORD}} | |
GF_SECURITY_ADMIN_USER=${{secrets.GF_SECURITY_ADMIN_USER}} | |
ALLOY_API_KEY=${{secrets.ALLOY_API_KEY}} | |
FISHJAM_ROOM_VERSION=${{ steps.versions.outputs.fishjam_room }} | |
FISHJAM_VERSION=${{ steps.versions.outputs.fishjam }} | |
JF_SERVER_API_TOKEN=${{secrets.SERVER_API_TOKEN_CLOUD_STAGING}} | |
BE_HOST=${{env.BE_HOST}} | |
BE_JF_SECURE_CONNECTION=true | |
BE_JF_ADDRESS=${{vars.JF_HOST_CLOUD_STAGING}}" > .env | |
- name: Remove old containers on first host | |
uses: JimCronqvist/action-ssh@master | |
with: | |
hosts: ${{ secrets.STAGING_HOST }} | |
privateKey: ${{ secrets.SSH_PRIV_KEY }} | |
command: | | |
docker ps -aq | xargs -r docker stop | xargs -r docker rm | |
- name: Deploy docker compose to a pre-configured server on first host | |
uses: TapTap21/[email protected] | |
with: | |
remote_docker_host: ${{ secrets.STAGING_HOST }} | |
ssh_private_key: ${{ secrets.SSH_PRIV_KEY }} | |
ssh_public_key: ${{ secrets.SSH_PUB_KEY }} | |
stack_file_name: ${{ env.COMPOSE_FILE_NAME }} | |
args: -p ${{ env.PROJECT }} --env-file .env up -d --remove-orphans --build |