- Updated Pupeeter config #222
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish components | |
on: | |
push: | |
branches: | |
- main | |
- 'release/**' | |
- 'feature/**' | |
- develop | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
outputs: | |
majorMinorPatch: ${{ steps.setoutputs.outputs.majorMinorPatch }} | |
semver: ${{ steps.setoutputs.outputs.semver }} | |
fullsemver: ${{ steps.setoutputs.outputs.fullsemver }} | |
buildmetadata: ${{ steps.setoutputs.outputs.buildmetadata }} | |
steps: | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0 | |
with: | |
versionSpec: '5.x' | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0 | |
- name: Set outputs | |
id: setoutputs | |
run: | | |
echo "majorMinorPatch=$GitVersion_MajorMinorPatch" >> "$GITHUB_OUTPUT" | |
echo "semver=$GitVersion_SemVer" >> "$GITHUB_OUTPUT" | |
echo "fullsemver=$GitVersion_FullSemVer" >> "$GITHUB_OUTPUT" | |
echo "buildmetadata=$GitVersion_BuildMetaData" >> "$GITHUB_OUTPUT" | |
tests_components: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./packages/components | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: | | |
export PUPPETEER_SKIP_DOWNLOAD=true | |
pnpm install | |
- name: Tests | |
run: | | |
node node_modules/puppeteer/install.js | |
pnpm run test:prod | |
build_spfx: | |
runs-on: ubuntu-latest | |
env: | |
SEMVER: ${{ needs.version.outputs.semver }} | |
MAJORMINORPATCH: ${{ needs.version.outputs.majorMinorPatch }} | |
needs: [version, build_components] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: | | |
export PUPPETEER_SKIP_DOWNLOAD=true | |
pnpm install | |
- name: Build | |
run: | | |
npx lerna run build --scope @pnp/modern-search-core | |
- name: Build + bundle SPFx | |
working-directory: ./apps/spfx | |
run: | | |
gulp update-docs-url --hosturl "https://github.com/microsoft-search/pnp-modern-search-core-components" | |
gulp update-version --value $MAJORMINORPATCH | |
pnpm run tailwindcss | |
gulp bundle --ship | |
gulp package-solution --ship | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pnp-modern-search-core-spfx | |
path: ${{ github.workspace }}/**/*.sppkg | |
release: | |
runs-on: ubuntu-latest | |
environment: production | |
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release') || github.event.inputs.create_release }} | |
needs: [version,build_spfx,build_teams] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: pnp-modern-search-core-spfx | |
- uses: actions/download-artifact@v3 | |
with: | |
name: pnp-modern-search-core-teams | |
- name: Create GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: PnP Modern Search Core Components - ${{ needs.version.outputs.semver }} | |
artifacts: ${{ github.workspace }}/**/*.sppkg,${{ github.workspace }}/apps/teams/appPackage/build/*.zip | |
bodyFile: ".github/workflows/release-template.md" | |
draft: true | |
generateReleaseNotes: true | |
allowUpdates: true | |
replacesArtifacts: true | |
prerelease: ${{ startsWith(github.ref_name, 'release') }} | |
tag: ${{ needs.version.outputs.majorMinorPatch }} | |
commit: ${{ github.ref_name }} | |
build_components: | |
runs-on: ubuntu-latest | |
needs: [version,tests_components] | |
defaults: | |
run: | |
working-directory: ./packages/components | |
env: | |
VERSION: ${{ format('{0}-{1}',needs.version.outputs.semver, needs.version.outputs.buildmetadata) }} | |
steps: | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: | | |
export PUPPETEER_SKIP_DOWNLOAD=true | |
pnpm install | |
- name: Version package | |
run: pnpm version $VERSION --no-git-tag-version | |
- name: Bundle | |
run: pnpm run bundle:prod | |
- name: Build | |
run: pnpm run build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build_dist | |
path: | | |
${{ github.workspace }}/packages/components | |
!${{ github.workspace }}/**/node_modules | |
!${{ github.workspace }}/**/src | |
!${{ github.workspace }}/**/dev | |
!${{ github.workspace }}/**/assets | |
!${{ github.workspace }}/**/.pnpm-store | |
!${{ github.workspace }}/**/.vscode | |
!${{ github.workspace }}/**/.storybook | |
publish_components: | |
runs-on: ubuntu-latest | |
needs: [version,build_components] | |
env: | |
VERSION: ${{ needs.version.outputs.semver }} | |
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release') || github.event.inputs.create_release }} | |
steps: | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
registry-url: 'https://registry.npmjs.org' | |
- name: get-npm-version | |
id: package-version | |
run: echo "currentVersion=$(npm view @pnp/modern-search-core dist-tags.latest)" >> "$GITHUB_OUTPUT" | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build_dist | |
path: dist | |
- name: Publish | |
working-directory: ./dist | |
env: | |
CURRENT_VERSION: ${{ steps.package-version.outputs.currentVersion }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
if: $CURRENT_VERSION != ${{ needs.version.outputs.semver }} | |
run: | | |
if [ "$GITHUB_REF" == "refs/heads/develop" ] | |
then | |
npm publish --access=public --tag alpha | |
else | |
if [[ "$GITHUB_REF" == *"refs/heads/release"* ]] | |
then | |
npm publish --access=public --tag beta | |
else | |
npm publish --access=public | |
fi | |
fi | |
build_teams: | |
runs-on: ubuntu-latest | |
needs: [version,build_components] | |
defaults: | |
run: | |
working-directory: ./apps/teams | |
env: | |
VERSION: ${{ needs.version.outputs.semver }} | |
MAJORMINORPATCH: ${{ needs.version.outputs.majorMinorPatch }} | |
ENV_AzDeployAppId: ${{ vars.ENV_AZDEPLOYAPPID }} | |
ENV_AzDeployAppSecret: ${{ secrets.ENV_AZDEPLOYAPPSECRET }} | |
ENV_AzDeployTenantId: ${{ vars.ENV_AZDEPLOYTENANTID }} | |
ENV_AzDeploySubcriptionId: ${{ vars.ENV_AZDEPLOYSUBCRIPTIONID }} | |
ENV_AzResourceGroupName: ${{ secrets.ENV_AZRESOURCEGROUPNAME }} | |
ENV_MSSearchAppClientId: ${{ vars.ENV_MSSEARCHAPPCLIENTID }} | |
ENV_MSSearchAppScopes: ${{ vars.ENV_MSSEARCHAPPSCOPES }} | |
ENV_M365AccountName: ${{ vars.ENV_M365ACCOUNTNAME }} | |
ENV_M365AccountPassword: ${{ secrets.ENV_M365ACCOUNTPASSWORD }} | |
ENV_M365TenantId: ${{ vars.ENV_M365TENANTID }} | |
ENV_EnvName: ${{ vars.ENV_ENVNAME }} | |
steps: | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: | | |
pnpm install | |
- name: Build components# | |
shell: pwsh | |
working-directory: ./packages/components | |
run: | | |
pnpm version $VERSION --no-git-tag-version | |
pnpm run build | |
- name: Install TeamsFx CLI | |
run: | | |
npm install -g @microsoft/teamsfx-cli@2.0.1 | |
- name: Run PowerShell deployment | |
shell: pwsh | |
working-directory: ./ | |
run: | | |
./deploy/deploy-teams.ps1 -Env CI -Version "$env:MAJORMINORPATCH" -Verbose | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pnp-modern-search-core-teams | |
path: | | |
${{ github.workspace }}/apps/teams/appPackage/build/*.zip | |
${{ github.workspace }}/apps/teams/build/*.json | |