diff --git a/.github/workflows/on-push-main.yml b/.github/workflows/on-push-main.yml new file mode 100644 index 00000000..21d28fc3 --- /dev/null +++ b/.github/workflows/on-push-main.yml @@ -0,0 +1,53 @@ +name: Update gh-pages + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout sources 🔰 + uses: actions/checkout@v2 + + - name: Setup Node.js 16 🧮 + uses: actions/setup-node@v1 + with: + node-version: 16 + + - name: Cache Node.js modules 💾 + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.OS }}-node- + ${{ runner.OS }}- + + - name: Install dependencies ⏬ + run: npm ci + + - name: Build artifacts 🏗️ + run: npm run build + + - name: Get react-geo-client-template version 🔖 + run: | + echo "VERSION=$(node -pe "require('./package.json').version")" >> $GITHUB_ENV + + - name: Deploy (to docs/v${{ env.VERSION }}) 🚀 + uses: JamesIves/github-pages-deploy-action@v4.2.5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: gh-pages + folder: dist + target-folder: v${{ env.VERSION }} + + - name: Deploy (to docs/latest) 🚀 + uses: JamesIves/github-pages-deploy-action@v4.2.5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: gh-pages + folder: dist + target-folder: latest