Skip to content

Commit

Permalink
chore: release-as 0.3.0
Browse files Browse the repository at this point in the history
Release-As: 0.3.0
  • Loading branch information
thelukewalton committed Dec 3, 2024
0 parents commit ecbc8d9
Show file tree
Hide file tree
Showing 389 changed files with 40,272 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"projects": {
"default": "zeta-ds"
},
"targets": {
"zeta-ds": {
"hosting": {
"web": [
"zeta-web-main"
]
}
}
}
}
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/releases/** binary
/.yarn/plugins/** binary
/.yarn/cache/** binary
*.json linguist-language=JSON-with-Comments
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @benken @thelukewalton @mikecoomber
36 changes: 36 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "CodeQL"

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
schedule:
- cron: "24 8 * * 0"

jobs:
codeql:
name: Analyze Code Quality
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["javascript"]

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
21 changes: 21 additions & 0 deletions .github/workflows/create-figma-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Create documentation links on Figma

on: workflow_dispatch

jobs:
link-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
- name: Run npm i
run: npm ci
- name: Create custom-elements.json
run: npm run analyze
- name: Create documentation links
uses: ./.github/workflows/link-docs
with:
figma-access-token: ${{ secrets.FIGMA_TOKEN }}
14 changes: 14 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Dependency Review"
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: "Dependency Review"
uses: actions/dependency-review-action@v3
9 changes: 9 additions & 0 deletions .github/workflows/link-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: "Create documentation links"
description: "Create storybook links on the Figma components"
inputs:
figma-access-token:
description: "The personal access token given by Figma. Required to make API calls"
required: true
runs:
using: "node20"
main: "index.js"
59 changes: 59 additions & 0 deletions .github/workflows/link-docs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import core from "@actions/core";
import manifest from "../../../custom-elements.json" assert { type: "json" };

const FILE_KEY = "JesXQFLaPJLc1BdBM4sisI";

const postDevResources = async links => {
const url = "https://api.figma.com/v1/dev_resources";
const response = await fetch(url, {
method: "POST",
body: JSON.stringify({
dev_resources: links.map(link => {
return { name: "Storybook", url: link.storybook, node_id: link.nodeId, file_key: FILE_KEY };
})
}),
headers: {
"Content-type": "application/json; charset=UTF-8",
"X-FIGMA-TOKEN": core.getInput("figma-access-token")
}
});

console.log(await response.json());
if (response.status != 200) {
core.setFailed(response.statusText);
}
};

const getNodeId = figmaUrl => {
const paramsStr = figmaUrl.split("?")[1];
const params = paramsStr.split("&");
const nodeIdParam = params.find(param => param.split("=")[0] == "node-id");
const nodeId = nodeIdParam.split("=")[1];
return nodeId.replace(/-/g, ":").replace(/\%3A/g, ":");
};

const main = () => {
const links = [];
manifest.modules.forEach(module => {
const classDec = module.declarations.find(dec => dec.kind == "class");
if (classDec?.figma && classDec?.storybook) {
if (Array.isArray(classDec.figma)) {
links.push(
...classDec.figma.map(figmaLink => {
return { nodeId: getNodeId(figmaLink.name), storybook: classDec?.storybook.name };
})
);
} else {
links.push({
nodeId: getNodeId(classDec.figma.name),
storybook: classDec?.storybook.name
});
}
} else if (classDec) {
console.warn(`${classDec.name} is missing documentation links`);
}
});
postDevResources(links);
};

main();
42 changes: 42 additions & 0 deletions .github/workflows/on-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI - On Main

on:
workflow_dispatch:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
deploy-qa-demo:
name: Deploy preview version of the storybook on firebase
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.x.x
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Create custom-elements.json
run: npm run analyze
- name: Build storybook
run: npm run storybook:build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ZETA_DS }}"
channelId: "live"
26 changes: 26 additions & 0 deletions .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI - On Release

on:
workflow_dispatch:
release:
types: [released]

jobs:
deploy-website:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'zebratechnologies',
repo: 'zeta',
workflow_id: 'deploy.yml',
ref: 'main',
})
publish-web:
uses: ./.github/workflows/publish-web.yml
secrets: inherit
21 changes: 21 additions & 0 deletions .github/workflows/publish-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI - Publish web
on:
workflow_dispatch:
workflow_call:
secrets:
NPM_TOKEN:
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- name: Install packages
run: npm ci
- name: Compile Typescript files
run: npm run build
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
125 changes: 125 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: CI - Pull Request

on: pull_request

# Pull Request Runs on the same branch will be cancelled
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true

jobs:
code-quality:
name: Check the code quality
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.x.x
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Store Playwright's Version
id: store-playwright-version
run: |
PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//')
echo "Playwright's Version: $PLAYWRIGHT_VERSION"
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Cache Playwright Browsers for Playwright's Version
id: cache-playwright-browsers
uses: actions/cache@v3
env:
PLAYWRIGHT_VERSION: ${{ steps.store-playwright-version.outputs.PLAYWRIGHT_VERSION }}
if: env.PLAYWRIGHT_VERSION == 'true'
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
- name: Install playwright browsers
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
- name: Run custom elements manifest analyzer
run: npm run analyze
- name: Run eslint
run: npm run lint
- name: Run prettier
run: npm run prettier
- name: Run lit-analyzer
run: npm run lint:lit-analyzer
- name: Run tests
run: npm run test -- --debug
- name: Test tsdoc
run: npm run docs
- name: Check for modified files
id: git-check
run: echo "modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_ENV
- name: Update changes in GitHub repository
env:
MODIFIED: ${{ steps.git-check.outputs.modified }}
if: env.MODIFIED == 'true'
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git add -A
git commit -m '[automated commit] lint format and import sort'
git push
generate-localizations:
name: Generate localizations.
needs: [code-quality]
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.x.x
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run lit-localize extract
run: npm run localize:extract
- name: Run lit-localize build
run: npm run localize:build
- name: Check diff
id: diff
run: git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit files
if: steps.diff.outputs.changed == 'true'
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add .
git commit -m "Generated locales"
git push
deploy-preview:
timeout-minutes: 20
name: Deploy preview version of the storybook on firebase
needs: [generate-localizations]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.x.x
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Create custom-elements.json
run: npm run analyze
- name: Build storybook
run: npm run storybook:build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ZETA_DS }}"
expires: 7d
channelId: "pr-${{ github.event.number }}-${{ github.event.pull_request.head.ref }}"
Loading

0 comments on commit ecbc8d9

Please sign in to comment.