Trying to add github actions v2.6 #18
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 and Update | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Doppler CLI | |
env: | |
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }} | |
run: | | |
(curl -Ls --tlsv1.2 --proto "=https" --retry 3 https://cli.doppler.com/install.sh || wget -t 3 -qO- https://cli.doppler.com/install.sh) | sudo sh | |
doppler --version | |
- name: Retrieve secrets from Doppler | |
run: doppler secrets download --no-file --format env | |
env: | |
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }} | |
DOPPLER_PROJECT: setlist-generator | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and push Docker images | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
run: | | |
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin | |
docker buildx create --use | |
docker buildx build --tag elicot/setlist-generator-frontend:latest --push /home/Github/setListGenerator/frontend | |
docker buildx build --tag elicot/setlist-generator-backend:latest --push /home/Github/setListGenerator/backend | |
- name: SSH into remote server and update Docker Stack | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_SERVER }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: ${{ secrets.REMOTE_PORT }} | |
script: | | |
cd /home/Github/setListGenerator | |
git fetch | |
git pull | |
docker stack deploy -c docker-stack.yml setlist-generator | |
env: | |
SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
MONGO_URI: ${{ secrets.MONGO_URI }} | |
REACT_APP_BACKEND_URL: ${{ secrets.REACT_APP_BACKEND_URL }} |