name: Deploy to website on: push: branches: [master] workflow_dispatch: jobs: deploy: # Adjust this label if your act_runner registers under a different one runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '22' - name: Install hexo-cli and yarn run: npm install -g hexo-cli yarn - name: Install dependencies run: yarn install --frozen-lockfile # hexo-deployer-sftp reads credentials from the hexo config, which # cannot take env vars directly. Generate an override config from # Gitea Actions secrets instead; it is never committed to the repo. - name: Write deploy config from secrets env: SFTP_HOST: ${{ secrets.SFTP_HOST }} SFTP_USER: ${{ secrets.SFTP_USER }} SFTP_PASS: ${{ secrets.SFTP_PASS }} run: | printf 'deploy:\n - type: sftp\n host: %s\n port: 22\n user: %s\n pass: %s\n remotePath: /www/wwwroot/leonxu260.dev\n' \ "$SFTP_HOST" "$SFTP_USER" "$SFTP_PASS" > _deploy.yml - name: Build site run: hexo generate - name: Deploy via SFTP run: hexo deploy --config _config.yml,_deploy.yml