diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml index 8dd0cb5..7b3eaf3 100644 --- a/.forgejo/workflows/deploy.yaml +++ b/.forgejo/workflows/deploy.yaml @@ -17,7 +17,7 @@ concurrency: jobs: deploy: - runs-on: ubuntu-latest + runs-on: docker steps: - name: Checkout uses: actions/checkout@v6 @@ -30,25 +30,27 @@ jobs: - name: Generate HTML run: | cd go-vanityurls - ln -s ../yanity.yaml ./vanity.yaml + ln -sf ../vanity.yaml ./vanity.yaml go run main.go - - name: Install rclone - run: apt install rclone - - name: Configure rclone + - name: Upload HTML env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }} + SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }} run: | + apt update && apt install expect rclone mkdir ~/.ssh - cat < ~/.ssh/id_ed25519.pub <<< $SSH_PUBLIC_KEY - cat < ~/.ssh/id_ed25519 <<< $SSH_PRIVATE_KEY + cat > ~/.ssh/id_ed25519.pub <<< $SSH_PUBLIC_KEY + cat > ~/.ssh/id_ed25519 <<< $SSH_PRIVATE_KEY + chmod 600 ~/.ssh/id_ed25519 ~/.ssh/id_ed25519.pub mkdir ~/.config/rclone - cat < ~/.config/rclone/config.conf <<<-EOF - [bridget] - type = sftp - host = bridget - user = www-data + cat > ~/.config/rclone/rclone.conf <<< $'[bridget]\ntype = sftp\nhost = bridget.arimelody.space\nport = 40195\nuser = vanity' + eval `ssh-agent` + expect <<-EOF + spawn ssh-add ~/.ssh/id_ed25519 + expect "Enter passphrase for /root/.ssh/id_ed25519:" + send "$SSH_PASSWORD\n"; + expect "Identity added: /root/.ssh/id_ed25519 (/root/.ssh/id_rsa)" + interact EOF - - name: Upload HTML - run: | rclone sync --delete-during -vv ./go-vanity/public bridget:/var/www/vanity