Skip to content

test(e2e): test for shorter label; upgrade playwright and CSS; keep e… #301

test(e2e): test for shorter label; upgrade playwright and CSS; keep e…

test(e2e): test for shorter label; upgrade playwright and CSS; keep e… #301

Workflow file for this run

name: CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 20 ]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm test
- name: Save @pod-os/core build
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: core-build
path: |
core/dist/
core/lib/
core/types/
core/package.json
retention-days: 1
- name: Save @pod-os/elements build
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: elements-build
path: |
elements/dist/
elements/loader/
elements/package.json
retention-days: 1
npm-publish-core-build:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
outputs:
prereleaseVersion: ${{ steps.prerelease.outputs.version }}
steps:
- uses: actions/download-artifact@v3
with:
name: core-build
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: rlespinasse/[email protected]
- name: prerelease version
run: |
echo "::set-output name=version::$(npm version prerelease --preid ${GITHUB_SHA_SHORT} --no-git-tag-version)"
id: prerelease
- run: echo prerelease version is ${{ steps.prerelease.outputs.version }}
- uses: JS-DevTools/npm-publish@v1
name: Publish @pod-os/core
with:
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ env.GITHUB_REF_SLUG }}
npm-publish-elements-build:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
outputs:
prereleaseVersion: ${{ steps.prerelease.outputs.version }}
steps:
- uses: actions/download-artifact@v3
with:
name: elements-build
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: rlespinasse/[email protected]
- name: prerelease version
run: |
echo "::set-output name=version::$(npm version prerelease --preid ${GITHUB_SHA_SHORT} --no-git-tag-version)"
id: prerelease
- run: echo prerelease version is ${{ steps.prerelease.outputs.version }}
- uses: JS-DevTools/npm-publish@v1
name: Publish @pod-os/elements
with:
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ env.GITHUB_REF_SLUG }}
build-pages:
if: github.ref == 'refs/heads/main'
needs:
- npm-publish-elements-build
- npm-publish-core-build
runs-on: ubuntu-latest
steps:
- run: echo elements version is ${{ needs.npm-publish-elements-build.outputs.prereleaseVersion }}
- run: echo core version is ${{ needs.npm-publish-core-build.outputs.prereleaseVersion }}
- uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install storybook
working-directory: ./storybook
run: npm ci
- name: Build storybook
working-directory: ./storybook
env:
STORYBOOK_POD_OS_ELEMENTS_DIST_URL: https://cdn.jsdelivr.net/npm/@pod-os/elements@${{ needs.npm-publish-elements-build.outputs.prereleaseVersion }}/dist/elements
run: npm run build
- name: Upload pages
uses: actions/upload-pages-artifact@v1
with:
path: 'gh-pages'
deploy-pages:
if: github.ref == 'refs/heads/main'
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build-pages
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
npm-release-latest-core:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: core-build
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: JS-DevTools/npm-publish@v1
name: Release @pod-os/core
with:
token: ${{ secrets.NPM_TOKEN }}
tag: latest
npm-release-latest-elements:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
outputs:
releaseType: ${{ steps.release.outputs.type }}
releaseVersion: ${{ steps.release.outputs.version }}
steps:
- uses: actions/download-artifact@v3
with:
name: elements-build
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: JS-DevTools/npm-publish@v1
id: release
name: Release @pod-os/elements
with:
token: ${{ secrets.NPM_TOKEN }}
tag: latest
deploy-pod-os-apps:
needs: npm-release-latest-elements
if: needs.npm-release-latest-elements.outputs.releaseType != 'none'
runs-on: ubuntu-latest
env:
POD_OS_ELEMENTS_VERSION: ${{ needs.npm-release-latest-elements.outputs.releaseVersion }}
steps:
- run: echo release apps based on @pod-os/elements version ${POD_OS_ELEMENTS_VERSION}
- uses: actions/checkout@v3
- name: Build PodOS Browser
working-directory: ./apps
run: make pos-app-browser
- name: Deploy PodOS Browser
working-directory: ./apps
run: npx netlify-cli deploy --site=pod-os-browser --dir=dist/pos-app-browser --prod
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_POD_OS_BROWSER_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}