Skip to content

🚢 add support for spfx v1.11 #17

🚢 add support for spfx v1.11

🚢 add support for spfx v1.11 #17

######################################################
# Deploy a prerelease NPM package version
# when code pushed to master
######################################################
name: Publish prerelease (NPM package publish @next)
on:
push:
branches:
- main
env:
NODE_VERSION: '20.x'
# NPM_TOKEN: <org.secret>
permissions:
id-token: write
jobs:
######################################################################
# build NPM package for pre-release
######################################################################
build:
name: Build NPM package
# only run if in our repo & if [skip-ci] is not in the commit message
if: github.repository_owner == 'voitanos' && !contains(github.event.head_commit.message,'[skip-ci]')
runs-on: ubuntu-latest
steps:
######################################################################
# Checkout code
######################################################################
- name: Checkout repo codebase
uses: actions/checkout@v4
with:
fetch-depth: 1
clean: true
submodules: false
######################################################################
# configure Node.js
######################################################################
- name: Setup Node ${{ env.NODE_VERSION }} environment
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
######################################################################
# restore cached dependencies
######################################################################
- name: Restore cached dependencies
uses: actions/cache@v4
id: node_module_cache
with:
path: node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('package-lock.json') }}
######################################################################
# install dependencies (if restore cached deps failed)
######################################################################
- name: Install dependencies
if: steps.node_module_cache.outputs.cache-hit != 'true'
shell: bash
run: npm ci
######################################################################
# build package
######################################################################
- name: Build package
shell: bash
run: npm run build --if-present
######################################################################
# compress & upload built package as artifact
######################################################################
- name: Compress built project
run: tar -cvf build.tar --exclude node_modules ./
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: build-${{ env.NODE_VERSION }}
path: build.tar
######################################################################
# build NPM package for pre-release
######################################################################
publish_to_npm:
name: Publish NPM package (@next)
# only run if in our repo & if [skip-cd] is not in the commit message
if: github.repository_owner == 'voitanos' && !contains(github.event.head_commit.message,'[skip-cd]')
needs: build
runs-on: ubuntu-latest
steps:
######################################################################
# download & uncompress built package as artifact
######################################################################
- uses: actions/download-artifact@v4
with:
name: build-${{ env.NODE_VERSION }}
- name: Unpack build artifact
run: tar -xvf build.tar && rm build.tar
######################################################################
# configure Node.js
######################################################################
- name: Setup Node ${{ env.NODE_VERSION }} environment
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
######################################################################
# restore cached dependencies
######################################################################
- name: Restore cached dependencies
uses: actions/cache@v4
id: node_module_cache
with:
path: node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('package-lock.json') }}
######################################################################
# install dependencies (if restore cached deps failed)
######################################################################
- name: Install dependencies
if: steps.node_module_cache.outputs.cache-hit != 'true'
shell: bash
run: npm ci
######################################################################
# update package name
######################################################################
- name: Stamp 'beta' to package version
run: node scripts/update-package-version.js $GITHUB_SHA
######################################################################
# publish NPM package as preview release
######################################################################
- name: Publish preview release as NPM @next
run: npm publish --tag next --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}