markjreed is deploying a new version #90
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 | |
| run-name: ${{ github.actor }} is deploying a new version | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| jobs: | |
| deploy-to-host: | |
| name: "Deploy to hosting provider" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 2 | |
| - name: fetch-tags | |
| run: git fetch --tags | |
| - name: bump-patchlevel | |
| run: | | |
| ${{ github.workspace }}/.github/bin/bump-tag "$COMMIT_MSG" | |
| env: | |
| COMMIT_MSG: ${{ github.event.head_commit.message }} | |
| - name: get-version | |
| run: git describe --tags HEAD > ${{ github.workspace }}/version.txt | |
| - name: get-commit | |
| run: git rev-parse HEAD > ${{ github.workspace }}/commit.txt | |
| - name: configure-ssh | |
| run: | | |
| mkdir -p ~/.ssh/ | |
| echo "$SSH_KEY" > ~/.ssh/staging.key | |
| chmod 600 ~/.ssh/staging.key | |
| cat >>~/.ssh/config <<END | |
| Host staging | |
| HostName $SSH_HOST | |
| User $SSH_USER | |
| IdentityFile ~/.ssh/staging.key | |
| StrictHostKeyChecking no | |
| END | |
| env: | |
| SSH_USER: ${{ secrets.SSH_USER }} | |
| SSH_KEY: ${{ secrets.SSH_KEY }} | |
| SSH_HOST: ${{ secrets.SSH_HOST }} | |
| - name: copy-files | |
| run: | | |
| rsync -Cavz --delete --exclude=.git\* --rsh=ssh ${{ github.workspace }}/. staging:www/foxtrot/. |