Deploy Docusaurus Website #17
Workflow file for this run
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 Docusaurus Website | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| if: false | |
| run: npm install | |
| - name: Build Operaton site | |
| if: false | |
| run: | | |
| npm run build || echo "Build failed, proceeding anyway if build/ exists" | |
| .github/script/release-assets.sh | |
| - name: Check if build directory exists | |
| if: false | |
| run: | | |
| if [ ! -d "build" ]; then | |
| echo "Build directory does not exist. Exiting." | |
| exit 1 | |
| fi | |
| - name: Set up SSH key | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| ssh-keyscan -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | |
| - name: Deploy to remote server via rsync | |
| if: false | |
| run: | | |
| rsync -avz --delete ./build/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_PATH }} | |
| env: | |
| RSYNC_RSH: ssh -p ${{ secrets.SSH_PORT }} | |
| - name: Create symlink to latest release | |
| run: | | |
| TAG_NAME=$(gh api repos/operaton/operaton/releases/latest --jq .tag_name) | |
| ssh -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} \ | |
| "ln -sfn ${{ secrets.SSH_PATH }}/reference/${TAG_NAME} ${{ secrets.SSH_PATH }}/reference/latest" |