Skip to content

Commit

Permalink
Deploy to strato with sftp
Browse files Browse the repository at this point in the history
  • Loading branch information
Daanvm committed Oct 12, 2024
1 parent a51c424 commit 26f2b20
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
34 changes: 28 additions & 6 deletions .github/workflows/deploy-strato.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,41 @@ jobs:
name: Build website zip
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v3
- 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

# TODO: remove debug
- name: Debug print all files
run: find ${GITHUB_WORKSPACE}
deploy:
name: Deploy website to Strato
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

# TODO: upload to sftp
- 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 "sftp://${{ secrets.STRATO_USERNAME }}:${{ secrets.STRATO_PASSWORD }}@ssh.strato.com:22/" < /tmp/commands.ftp
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN /var/www/html/scripts/christelmusic warmup

FROM builder as zipper

RUN tar -czvf /build.tar.gz /var/www/html/*
RUN tar -czvf /build.tar.gz /var/www/html/* --exclude-vcs-ignores

FROM base

Expand Down

0 comments on commit 26f2b20

Please sign in to comment.