Update backend #42
This file contains hidden or 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: push | |
| jobs: | |
| build-and-deploy: | |
| name: build and deploy (main) | |
| timeout-minutes: 10 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to Docker registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: postmodern.alexdaniel.org | |
| username: 'ttuwiki' | |
| password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
| - name: Build and push | |
| id: docker_build | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| tags: postmodern.alexdaniel.org/ttuwiki-backend:${{ github.sha }} ${{ github.ref == 'refs/heads/main' && ', postmodern.alexdaniel.org/ttuwiki-backend:latest' || '' }} | |
| - name: Set SSH key | |
| if: github.ref == 'refs/heads/main' | |
| uses: webfactory/[email protected] | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_KEY }} | |
| - name: Auth | |
| if: github.ref == 'refs/heads/main' | |
| run: ssh-keyscan -H postmodern.alexdaniel.org >> ~/.ssh/known_hosts | |
| - name: Deploy | |
| if: github.ref == 'refs/heads/main' | |
| run: docker stack deploy --with-registry-auth -c compose.yaml ttuwiki-backend | |
| env: | |
| DOCKER_HOST: ssh://[email protected] | |
| build-and-deploy-files: | |
| name: build and deploy (files) | |
| timeout-minutes: 10 | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./ttuwikifiles | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to Docker registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: postmodern.alexdaniel.org | |
| username: 'ttuwiki' | |
| password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
| - name: Build and push | |
| id: docker_build | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./ttuwikifiles | |
| push: true | |
| tags: postmodern.alexdaniel.org/ttuwiki-backend-files:${{ github.sha }} ${{ github.ref == 'refs/heads/main' && ', postmodern.alexdaniel.org/ttuwiki-backend-files:latest' || '' }} | |
| - name: Set SSH key | |
| if: github.ref == 'refs/heads/main' | |
| uses: webfactory/[email protected] | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_KEY }} | |
| - name: Auth | |
| if: github.ref == 'refs/heads/main' | |
| run: ssh-keyscan -H postmodern.alexdaniel.org >> ~/.ssh/known_hosts | |
| - name: Deploy | |
| if: github.ref == 'refs/heads/main' | |
| run: docker stack deploy --with-registry-auth -c compose.yaml ttuwiki-backend-files | |
| env: | |
| DOCKER_HOST: ssh://[email protected] |