From 037660077b8dd28f203b5577820f334edbb58d64 Mon Sep 17 00:00:00 2001 From: Jean-Michel DECORET Date: Thu, 19 Sep 2024 10:44:16 +0200 Subject: [PATCH] Change yaml for GithubPages Update pipeline script to publish directly dist to GithubPage (instead of sftp server) --- .github/workflows/deploy.yml | 56 +++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9a2d7b3..b606ee6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,17 +1,33 @@ -name: Build and Publish yadoms Website + on: + # Runs on pushes targeting the default branch push: - branches: - - main + branches: ["main"] pull_request: - branches: - - main + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + jobs: - deploy: - name: Deploy + # Build job + build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version: 16 @@ -20,13 +36,19 @@ jobs: run: | npm ci npm run build - - name: List output files - run: ls - - - name: Upload ftp - uses: sebastianpopp/ftp-action@releases/v2 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: - host: ${{ secrets.FTP_SERVER }} - user: ${{ secrets.FTP_USERNAME }} - password: ${{ secrets.FTP_PASSWORD }} - localDir: 'dist/' + path: dist + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4