|
| 1 | +name: Deploy Docs |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + deploy: |
| 10 | + name: Deploy |
| 11 | + runs-on: ubuntu-latest |
| 12 | + environment: |
| 13 | + name: docs.pluginpal.io |
| 14 | + url: https://docs.pluginpal.io/config-sync |
| 15 | + steps: |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@v3 |
| 18 | + |
| 19 | + - name: Set up Docker |
| 20 | + uses: actions/setup-node@v3 |
| 21 | + with: |
| 22 | + node-version: '14' |
| 23 | + |
| 24 | + - name: Build a Docker image |
| 25 | + run: | |
| 26 | + cd docs |
| 27 | + docker build \ |
| 28 | + -t docs-config-sync:latest . |
| 29 | + docker save -o ../docs-config-sync-latest.tar docs-config-sync:latest |
| 30 | +
|
| 31 | + - name: Transfer the Docker image to the Dokku server |
| 32 | + uses: appleboy/scp-action@v0.1.3 |
| 33 | + with: |
| 34 | + host: ${{ secrets.SSH_HOST }} |
| 35 | + username: ${{ secrets.SSH_CI_USERNAME }} |
| 36 | + password: ${{ secrets.SSH_CI_PASSWORD }} |
| 37 | + source: docs-config-sync-latest.tar |
| 38 | + target: /var/lib/dokku/data/storage/docs/docker-images |
| 39 | + |
| 40 | + - name: Deploy the Dokku app based on the Docker image |
| 41 | + uses: appleboy/ssh-action@v0.1.10 |
| 42 | + with: |
| 43 | + host: ${{ secrets.SSH_HOST }} |
| 44 | + username: ${{ secrets.SSH_CI_USERNAME }} |
| 45 | + password: ${{ secrets.SSH_CI_PASSWORD }} |
| 46 | + script_stop: true |
| 47 | + script: | |
| 48 | + sudo docker load -i /var/lib/dokku/data/storage/docs/docker-images/docs-config-sync-latest.tar |
| 49 | + DOCS_CONFIG_SYNC_LATEST_IMAGE=$(sudo docker images --format "{{.ID}}" docs-config-sync:latest) |
| 50 | + sudo docker tag docs-config-sync:latest docs-config-sync:$DOCS_CONFIG_SYNC_LATEST_IMAGE |
| 51 | + dokku git:from-image docs-config-sync docs-config-sync:$DOCS_CONFIG_SYNC_LATEST_IMAGE |
| 52 | + sudo docker system prune --all --force |
0 commit comments