🧩 Build Web Components for 🌱 v1.1.5 #78
Workflow file for this run
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: Web Components | |
run-name: 🧩 Build Web Components for ${{ github.event_name == 'issue_comment' && 'PR' || (github.event_name == 'release' && '🏷' || '🌱') }} ${{github.event_name == 'issue_comment' && github.event.issue.number || github.ref_name}} | |
# This workflow runs whenever a commit is pushed on main or a release is published | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
release: | |
types: [published] | |
concurrency: | |
group: webcomponents-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
NODE_VERSION: 18.16.1 | |
PUBLISH_BRANCH: wc-dist | |
jobs: | |
build-publish-script: | |
name: Build and publish the Web Components | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.checks.outputs.ref }} | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build webcomponents script | |
run: | | |
mkdir wc-dist | |
npm run build:demo | |
mv dist/demo/webcomponents/gn-wc.js wc-dist | |
- name: Upload archives to release | |
if: github.event_name == 'release' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: wc-dist/gn-wc.js | |
tag: ${{ github.ref }} | |
overwrite: true | |
- name: Publish web component to ${{ env.PUBLISH_BRANCH }}-${{ github.ref_name }} branch | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force_orphan: true | |
publish_dir: ./wc-dist | |
publish_branch: ${{ env.PUBLISH_BRANCH }}-${{ github.ref_name }} |