Deploy to strato with sftp #14
Workflow file for this run
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
on: | |
push: | |
branches: | |
- master | |
- deploy-strato | |
jobs: | |
build: | |
name: Build website zip | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build .tar.gz file | |
run: | | |
docker build --tag local-img/zipper --target zipper . | |
docker create --name zipper local-img/zipper | |
docker cp zipper:/build.tar.gz ./build.tar.gz | |
docker rm -f zipper | |
shell: bash | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-tar-gz | |
path: ./build.tar.gz | |
deploy: | |
name: Deploy website to Strato | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-tar-gz | |
- name: Extract .tar.gz file | |
run: | | |
tar -xzvf build.tar.gz | |
rm build.tar.gz | |
shell: bash | |
- name: Upload to Strato | |
# FROM: https://github.com/Atyn/simple-sftp-action/blob/main/action.yml | |
run: | | |
echo " | |
$(find . -type d | sed -e 's/^/mkdir /;') | |
mput -r . | |
exit | |
" > /tmp/commands.sftp | |
sftp -o StrictHostKeyChecking=no "sftp://${{ secrets.STRATO_SSH_USERNAME }}:${{ secrets.STRATO_SSH_PASSWORD }}@ssh.strato.com/" < /tmp/commands.sftp |