GitHub Actions on tags (#86) #3
Workflow file for this run
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 - Test Env. | |
on: | |
push: | |
tags: | |
- sprint-**-release-candidate | |
jobs: | |
PublishImages: | |
name: Publish Docker Images | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login | |
run: | | |
echo ${{secrets.PAT}} | docker login ghcr.io -u ${{github.actor}} --password-stdin | |
- name: Build and Publish | |
run: | | |
docker compose build --pull | |
docker-compose push | |
- name: Logout | |
run: docker logout | |
DeployTestEnv: | |
needs: PublishImages | |
name: Deploy Image in the Test Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install SSH keys | |
run: | | |
install -m 600 -D /dev/null ~/.ssh/id_rsa | |
echo "${{secrets.TEST_ENV_SSH_PRIVATE_KEY}}" > ~/.ssh/id_rsa | |
ssh-keyscan -H ${{secrets.TEST_ENV_SSH_HOST}} > ~/.ssh/known_hosts | |
- name: Connect and Pull | |
run: ssh ${{secrets.TEST_ENV_SSH_USER}}@${{secrets.TEST_ENV_SSH_HOST}} "cd /var/lib/bie && docker compose pull && docker compose up -d && exit" | |
- name: Cleanup | |
run: rm -rf ~/.ssh |