This GitHub action is forked from a repo that deployed project archives to SharePoint Online. The action is modified to deploy build folders of a React app.
Required The complete url of your sharepoint site. Example : https://you.sharepoint.com/sites/mySite
Required The path relative to the library where to upload a file. Example Shared documents/releases
.
โ ๏ธ Do not include the first slash
Required The username to use for authentication. Example [email protected]
.
Required The user's password. Example MyPassword123!
.
๐ก Tip : It is recommended to use GitHub Actions Secrets to store sensible informations like passwords
This action is particularly useful when triggered by new releases :
name: SharePoint Deploy
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
publish:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- name: Cloning repository
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install packages
run: npm install
- name: Build page
run: npm run build
env:
CI: false
- name: Remove everything except build folder
run: ls . | grep -v "build" | xargs rm -r
- name: Deploy to Sharepoint
uses: harsohailB/[email protected]
with:
site_url: 'https://you.sharepoint.com/sites/mySite'
library_folder: 'Shared documents/releases'
sharepoint_user: ${{ secrets.USER }}
sharepoint_password: ${{ secrets.PASSWORD }}