Created
August 17, 2022 07:41
-
-
Save CreedsCode/bf4f73bd1fd0f38dcc20d1c5652063b4 to your computer and use it in GitHub Desktop.
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: Server Build & Push | |
on: | |
push: | |
branches: [main] | |
paths: | |
- 'server/**' | |
- 'shared/**' | |
- docker-compose.prod.yml | |
- Dockerfile | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v2 | |
- name: Create env file | |
run: | | |
touch .env | |
echo "${{ secrets.SERVER_ENV_PROD }}" > .env | |
cat .env | |
- name: Build image | |
run: docker compose -f docker-compose.prod.yml build | |
- name: Install doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
- name: Log in to DO Container Registry | |
run: doctl registry login --expiry-seconds 600 | |
- name: Push image to DO Container Registry | |
run: docker compose -f docker-compose.prod.yml push | |
- name: Deploy Stack | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.GL_SSH_HOST }} | |
username: ${{ secrets.GL_SSH_USERNAME }} | |
key: ${{ secrets.GL_SSH_SECRET }} | |
port: ${{ secrets.GL_SSH_PORT }} | |
script: | | |
cd COMPOSEPATH | |
./init.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment