Deploy #244
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: | |
- workflow_dispatch | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout repo from GitHub | |
- uses: actions/checkout@v4 | |
# Set envars for deployment. | |
- name: Set env vars | |
run: | | |
if [ "${{ github.ref }}" = "refs/heads/develop" ]; then | |
echo "COMPOSE_SUFFIX=staging" >> $GITHUB_ENV | |
echo "PROJECT=clerk_test" >> $GITHUB_ENV | |
elif [ "${{ github.ref }}" = "refs/heads/master" ]; then | |
echo "COMPOSE_SUFFIX=prod" >> $GITHUB_ENV | |
echo "PROJECT=clerk" >> $GITHUB_ENV | |
else | |
echo "Please specify either the develop branch for staging or master branch for prod" | |
exit 1 | |
fi | |
# Setup transcrypt so that we can read secrets | |
- name: Checkout transcrypt | |
uses: actions/checkout@v4 | |
with: | |
repository: elasticdog/transcrypt | |
path: transcrypt | |
- name: Initialise transcrypt | |
run: ./transcrypt/transcrypt -c aes-256-cbc -p '${{ secrets.TRANSCRYPT_PASSWORD }}' --yes | |
# Update Docker Swarm on clerk server to deploy new container. | |
- name: Run deploy script | |
run: ./infra/deploy.sh | |
shell: bash | |
env: | |
CLERK_PRIVATE_SSH_KEY: ${{ secrets.CLERK_PRIVATE_SSH_KEY }} |