diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml index cf918b0..c2f49ac 100644 --- a/.github/workflows/dev.yaml +++ b/.github/workflows/dev.yaml @@ -1,38 +1,56 @@ -name: Deploy to All-Inkl +name: Deploy develop to Cloudflare Pages on: push: branches: [develop] workflow_dispatch: +permissions: + contents: read + deployments: write + +concurrency: + group: dev-deploy + cancel-in-progress: true + env: NODE_VERSION: '16.x' jobs: - build-and-deploy: - name: Build, and deploy to All-Inkl + deploy: + name: Build + wrangler pages deploy runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - name: Install packages - run: | - npm ci + run: npm ci - - name: Build code - run: | - npm run build + - name: Build + run: npm run build - - name: Deploy to All-Inkl - uses: SamKirkland/FTP-Deploy-Action@v4.3.4 + - name: Use Node.js 22 (wrangler) + uses: actions/setup-node@v4 with: - server: ${{ secrets.DEV_HOST }} - username: ${{ secrets.DEV_USER }} - password: ${{ secrets.DEV_PASSWORD }} - local-dir: './src/.vuepress/dist/' + node-version: "22" + + - name: Install Wrangler + run: npm install -g wrangler@4 + + - name: Deploy to Cloudflare Pages + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + COMMIT_MSG: ${{ github.event.head_commit.message }} + run: | + wrangler pages deploy ./src/.vuepress/dist \ + --project-name=dfx-docs-dev \ + --branch=develop \ + --commit-hash=${{ github.sha }} \ + --commit-message="$COMMIT_MSG" diff --git a/.github/workflows/prd.yaml b/.github/workflows/prd.yaml index 161a0af..9bf0d2c 100644 --- a/.github/workflows/prd.yaml +++ b/.github/workflows/prd.yaml @@ -1,38 +1,56 @@ -name: Deploy to All-Inkl +name: Deploy main to Cloudflare Pages on: push: branches: [main] workflow_dispatch: +permissions: + contents: read + deployments: write + +concurrency: + group: prd-deploy + cancel-in-progress: true + env: NODE_VERSION: '16.x' jobs: - build-and-deploy: - name: Build, and deploy to All-Inkl + deploy: + name: Build + wrangler pages deploy runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - name: Install packages - run: | - npm ci + run: npm ci - - name: Build code - run: | - npm run build + - name: Build + run: npm run build - - name: Deploy to All-Inkl - uses: SamKirkland/FTP-Deploy-Action@v4.3.4 + - name: Use Node.js 22 (wrangler) + uses: actions/setup-node@v4 with: - server: ${{ secrets.PRD_HOST }} - username: ${{ secrets.PRD_USER }} - password: ${{ secrets.PRD_PASSWORD }} - local-dir: './src/.vuepress/dist/' \ No newline at end of file + node-version: "22" + + - name: Install Wrangler + run: npm install -g wrangler@4 + + - name: Deploy to Cloudflare Pages + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + COMMIT_MSG: ${{ github.event.head_commit.message }} + run: | + wrangler pages deploy ./src/.vuepress/dist \ + --project-name=dfx-docs-prd \ + --branch=main \ + --commit-hash=${{ github.sha }} \ + --commit-message="$COMMIT_MSG"