Merge branch 'main' of github.com:serionist/tableau-component-library #50
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: Deploy Test App to GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: "lib" | |
cancel-in-progress: false | |
jobs: | |
verify: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
id: setup-node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' # Use a stable Node version | |
- name: Install Dependencies | |
id: install-deps | |
run: npm install | |
- name: Build Component Library | |
id: build-library | |
run: npm run build:component-library | |
- name: Build Test App | |
id: build-test-app | |
run: npm run build:github-pages | |
version-and-publish-library: | |
runs-on: ubuntu-latest | |
needs: verify | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- name: Update Version | |
id: update-version | |
run: | | |
CURRENT_VERSION=$(jq -r '.version' projects/component-library/package.json) | |
NEW_VERSION=$(npm version patch -m "Package version set to %s" --prefix projects/component-library | grep -o '[0-9.]*') | |
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Commit and Tag Version Update | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add projects/component-library/package.json | |
git commit -m "Package version set to $NEW_VERSION" | |
git tag "v$NEW_VERSION" | |
git push origin main --tags | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NEW_VERSION: ${{ env.NEW_VERSION }} | |
- name: Publish Component Library | |
run: | | |
npm install | |
npm run package | |
cd dist/component-library | |
npm publish --//registry.npmjs.org/:_authToken=$NPM_TOKEN | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
build-test-app: | |
runs-on: ubuntu-latest | |
needs: [verify, version-and-publish-library] | |
steps: | |
- name: Checkout Repository | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
id: setup-node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- name: Install Dependencies | |
id: install-deps | |
run: npm install | |
- name: Increment library version | |
id: set-version | |
run: npm version patch -m "Package version set to %s" --prefix projects/component-library | grep -o '[0-9.]*' | |
- name: Build Test App | |
id: build | |
run: npm run build:github-pages | |
- name: Upload static files as artifact | |
id: deployment | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./dist/test-app/browser | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build-test-app | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |