```yml name: Build and Deploy on: push: branches: - master jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 with: persist-credentials: false - name: Install run: | npm install npm run-script build - name: Install SSH Client - uses: webfactory/ssh-agent@v0.2.0 # This step installs the ssh client into the workflow run. There's many options available for this on the action marketplace. with: ssh-private-key: ${{ secrets.DEPLOY_KEY }} - name: Build and Deploy Repo uses: JamesIves/github-pages-deploy-action@releases/v3-test with: BASE_BRANCH: master BRANCH: gh-pages FOLDER: 'build' CLEAN: true SSH: true # SSH must be set to true so the deploy action knows which protocol to deploy with. ```
```yml name: Build and Deploy on: [push] jobs: build: runs-on: windows-latest # The first job utilizes windows-latest steps: - name: Checkout uses: actions/checkout@v2 with: persist-credentials: false - name: Install # The project is built using npm and placed in the 'build' folder. run: | npm install npm run-script build - name: Upload Artifacts # The project is then uploaded as an artifact named 'site'. uses: actions/upload-artifact@v1 with: name: site path: build deploy: needs: [build] # The second job must depend on the first one to complete before running, and uses ubuntu-latest instead of windows. runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 with: persist-credentials: false - name: Download Artifacts # The built project is downloaded into the 'site' folder. uses: actions/download-artifact@v1 with: name: site - name: Build and Deploy uses: JamesIves/github-pages-deploy-action@releases/v3 with: ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} BRANCH: gh-pages FOLDER: 'site' # The deployment folder should match the name of the artifact. Even though our project builds into the 'build' folder the artifact name of 'site' must be placed here. ```