From 1a5691a01cdb7f886b43fff6064339c7f575f159 Mon Sep 17 00:00:00 2001 From: Fynn Feldpausch Date: Tue, 17 Oct 2023 10:16:10 +0200 Subject: [PATCH] chore: ci workflow --- .github/workflows/angular.yml | 73 +++++---- .github/workflows/core.yml | 216 ++++++++++++++------------- .github/workflows/deploy.yml | 85 ++++++----- .github/workflows/install.yml | 33 ---- .github/workflows/react.yml | 71 +++++---- .github/workflows/release-please.yml | 39 ----- .github/workflows/release.yml | 66 ++++---- .github/workflows/tokens.yml | 35 ++++- 8 files changed, 302 insertions(+), 316 deletions(-) delete mode 100644 .github/workflows/install.yml delete mode 100644 .github/workflows/release-please.yml diff --git a/.github/workflows/angular.yml b/.github/workflows/angular.yml index e3e148e0..404eded3 100644 --- a/.github/workflows/angular.yml +++ b/.github/workflows/angular.yml @@ -1,30 +1,43 @@ -# name: 'Angular' -# on: -# push: -# branches: -# - '*' -# paths: -# - 'angular/**' -# jobs: -# build: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# - name: Setup pnpm -# uses: pnpm/action-setup@v2 -# with: -# version: 8 -# - name: Setup Node -# uses: actions/setup-node@v3 -# with: -# node-version-file: .nvmrc -# cache: pnpm -# cache-dependency-path: pnpm-lock.yaml -# - name: Install and Build -# run: | -# pnpm install -# pnpm run build:tokens -# pnpm run build:core -# pnpm run build:angular -# pnpm run build:angular-formly +name: Angular + +on: + push: + branches: + - "*" + # paths: + # - "angular/**" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + registry-url: https://registry.npmjs.org + - name: Setup pnpm + 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 + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Install + run: pnpm install + - name: Build + run: | + pnpm run build:tokens + pnpm run build:core + pnpm run build:angular + pnpm run build:angular-formly diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index cc84c753..d5924762 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -1,107 +1,109 @@ -# name: 'Core' -# on: -# push: -# branches: -# - '*' -# paths: -# - 'core/**' -# jobs: -# build: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# - name: Setup pnpm -# uses: pnpm/action-setup@v2 -# with: -# version: 8 -# - name: Setup Node -# uses: actions/setup-node@v3 -# with: -# node-version-file: .nvmrc -# cache: pnpm -# cache-dependency-path: pnpm-lock.yaml -# - name: Install and Build -# run: | -# pnpm install -# pnpm run build:tokens -# pnpm run build:core -# prettier: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# - name: Setup pnpm -# uses: pnpm/action-setup@v2 -# with: -# version: 8 -# - name: Setup Node -# uses: actions/setup-node@v3 -# with: -# node-version-file: .nvmrc -# cache: pnpm -# cache-dependency-path: pnpm-lock.yaml -# - name: Install and Check -# run: | -# pnpm install -# pnpm --filter @haiilo/catalyst run prettier:check -# eslint: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# - name: Setup pnpm -# uses: pnpm/action-setup@v2 -# with: -# version: 8 -# - name: Setup Node -# uses: actions/setup-node@v3 -# with: -# node-version-file: .nvmrc -# cache: pnpm -# cache-dependency-path: pnpm-lock.yaml -# - name: Install and Lint -# run: | -# pnpm install -# pnpm --filter @haiilo/catalyst run lint -# stylelint: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# - name: Setup pnpm -# uses: pnpm/action-setup@v2 -# with: -# version: 8 -# - name: Setup Node -# uses: actions/setup-node@v3 -# with: -# node-version-file: .nvmrc -# cache: pnpm -# cache-dependency-path: pnpm-lock.yaml -# - name: Install and Lint -# run: | -# pnpm install -# pnpm --filter @haiilo/catalyst run lint:style -# test: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# - name: Setup pnpm -# uses: pnpm/action-setup@v2 -# with: -# version: 8 -# - name: Setup Node -# uses: actions/setup-node@v3 -# with: -# node-version-file: .nvmrc -# cache: pnpm -# cache-dependency-path: pnpm-lock.yaml -# - name: Install Chrome -# run: sudo apt-get install -y google-chrome-stable -# - name: Install and Test -# run: | -# pnpm install -# pnpm run build:tokens -# pnpm --filter @haiilo/catalyst run test +name: "Core" + +on: + push: + branches: + - "*" + # paths: + # - "core/**" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + cache: pnpm + cache-dependency-path: pnpm-lock.yaml + - name: Install and Build + run: | + pnpm install + pnpm run build:tokens + pnpm run build:core + prettier: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + cache: pnpm + cache-dependency-path: pnpm-lock.yaml + - name: Install and Check + run: | + pnpm install + pnpm --filter @haiilo/catalyst run prettier:check + eslint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + cache: pnpm + cache-dependency-path: pnpm-lock.yaml + - name: Install and Lint + run: | + pnpm install + pnpm --filter @haiilo/catalyst run lint + stylelint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + cache: pnpm + cache-dependency-path: pnpm-lock.yaml + - name: Install and Lint + run: | + pnpm install + pnpm --filter @haiilo/catalyst run lint:style + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + cache: pnpm + cache-dependency-path: pnpm-lock.yaml + - name: Install Chrome + run: sudo apt-get install -y google-chrome-stable + - name: Install and Test + run: | + pnpm install + pnpm run build:tokens + pnpm --filter @haiilo/catalyst run test diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1de0f8bc..4bf70015 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,41 +1,44 @@ -# name: 'Deploy' -# on: -# push: -# branches: -# - main -# paths: -# - 'core/**' -# jobs: -# gh-pages: -# concurrency: ci-${{ github.ref }} -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# - name: Setup pnpm -# uses: pnpm/action-setup@v2 -# with: -# version: 8 -# - name: Setup Node -# uses: actions/setup-node@v3 -# with: -# node-version-file: .nvmrc -# cache: pnpm -# cache-dependency-path: pnpm-lock.yaml -# - name: Install and Build -# run: | -# pnpm install -# pnpm run build:tokens -# pnpm run build:core -# - name: Find and Replace -# uses: jacobtomlinson/gha-find-replace@v2 -# with: -# find: '/build/' -# replace: 'https://haiilo.github.io/catalyst/build/' -# regex: false -# include: core/www/index.html -# - name: Deploy -# uses: JamesIves/github-pages-deploy-action@v4.2.3 -# with: -# branch: gh-pages -# folder: core/www +name: Deploy + +on: + push: + branches: + - main + # paths: + # - "tokens/**" + # - "core/**" + +jobs: + gh-pages: + concurrency: ci-${{ github.ref }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + cache: pnpm + cache-dependency-path: pnpm-lock.yaml + - name: Install and Build + run: | + pnpm install + pnpm run build:tokens + pnpm run build:core + - name: Find and Replace + uses: jacobtomlinson/gha-find-replace@v2 + with: + find: "/build/" + replace: "https://haiilo.github.io/catalyst/build/" + regex: false + include: core/www/index.html + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4.2.3 + with: + branch: gh-pages + folder: core/www diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml deleted file mode 100644 index b9f13454..00000000 --- a/.github/workflows/install.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: "Install" - -on: - workflow_call: - -jobs: - install: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version-file: .nvmrc - registry-url: "https://registry.npmjs.org" - - name: Setup pnpm - 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 - - name: Setup pnpm cache - uses: actions/cache@v3 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - name: Install - run: pnpm install diff --git a/.github/workflows/react.yml b/.github/workflows/react.yml index 3b040f51..70c216cd 100644 --- a/.github/workflows/react.yml +++ b/.github/workflows/react.yml @@ -1,29 +1,42 @@ -# name: 'React' -# on: -# push: -# branches: -# - '*' -# paths: -# - 'react/**' -# jobs: -# build: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# - name: Setup pnpm -# uses: pnpm/action-setup@v2 -# with: -# version: 8 -# - name: Setup Node -# uses: actions/setup-node@v3 -# with: -# node-version-file: .nvmrc -# cache: pnpm -# cache-dependency-path: pnpm-lock.yaml -# - name: Install and Build -# run: | -# pnpm install -# pnpm run build:tokens -# pnpm run build:core -# pnpm run build:react +name: React + +on: + push: + branches: + - "*" + # paths: + # - "react/**" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + registry-url: https://registry.npmjs.org + - name: Setup pnpm + 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 + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Install + run: pnpm install + - name: Build + run: | + pnpm run build:tokens + pnpm run build:core + pnpm run build:react diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml deleted file mode 100644 index a04b39f8..00000000 --- a/.github/workflows/release-please.yml +++ /dev/null @@ -1,39 +0,0 @@ -on: - push: - branches: - - main - -permissions: - contents: write - pull-requests: write - -name: release-please - -jobs: - release-please: - runs-on: ubuntu-latest - steps: - - uses: google-github-actions/release-please-action@v3 - with: - command: manifest - - uses: actions/checkout@v4 - if: ${{ steps.release.outputs.release_created }} - - uses: actions/setup-node@v3 - with: - node-version: '18' - cache: 'pnpm' - registry-url: 'https://registry.npmjs.org' - if: ${{ steps.release.outputs.release_created }} - - uses: pnpm/action-setup@v2 - name: Install pnpm - with: - version: 8 - if: ${{ steps.release.outputs.release_created }} - - run: pnpm install - if: ${{ steps.release.outputs.release_created }} - - run: pnpm run build - if: ${{ steps.release.outputs.release_created }} - - run: pnpm run publish - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - if: ${{ steps.release.outputs.release_created }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ef31df44..75dfdc56 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,54 +1,56 @@ -name: 'Release' +name: Release on: push: branches: - main +permissions: + contents: write + pull-requests: write + jobs: release-please: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: google-github-actions/release-please-action@v3 + with: + command: manifest + release-type: node + - name: Checkout + uses: actions/checkout@v4 + if: ${{ steps.release.outputs.release_created }} + - name: Setup node + uses: actions/setup-node@v3 with: - node-version: '18' - registry-url: 'https://registry.npmjs.org' - - uses: pnpm/action-setup@v2 - name: Install pnpm + node-version-file: .nvmrc + registry-url: "https://registry.npmjs.org" + if: ${{ steps.release.outputs.release_created }} + - name: Setup pnpm + uses: pnpm/action-setup@v2 with: version: 8 run_install: false + if: ${{ steps.release.outputs.release_created }} - 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 + run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + if: ${{ steps.release.outputs.release_created }} + - name: Setup pnpm cache + uses: actions/cache@v3 with: path: ${{ env.STORE_PATH }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - - name: Install dependencies + if: ${{ steps.release.outputs.release_created }} + - name: Install run: pnpm install - - run: pnpm run build - # - run: pnpm run publish - # env: - # NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - -# name: 'Release' -# on: -# push: -# tags: -# - "v*.*.*" -# jobs: -# build: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# - name: Release -# uses: softprops/action-gh-release@v1 -# with: -# body_path: CHANGELOG.md + if: ${{ steps.release.outputs.release_created }} + - name: Build + run: pnpm run build + if: ${{ steps.release.outputs.release_created }} + - run: pnpm run publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + if: ${{ steps.release.outputs.release_created }} diff --git a/.github/workflows/tokens.yml b/.github/workflows/tokens.yml index 02099c8e..128e5c32 100644 --- a/.github/workflows/tokens.yml +++ b/.github/workflows/tokens.yml @@ -1,15 +1,40 @@ -name: 'Tokens' +name: Tokens on: push: branches: - - '*' + - "*" # paths: - # - 'tokens/**' + # - "tokens/**" jobs: install: - uses: ./.github/workflows/install.yml + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + registry-url: https://registry.npmjs.org + - name: Setup pnpm + 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 + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Install + run: pnpm install build: runs-on: ubuntu-latest needs: install @@ -19,6 +44,6 @@ jobs: - name: Commit files uses: stefanzweifel/git-auto-commit-action@v4 with: - commit_message: 'CI: update tokens' + commit_message: "CI: update tokens" commit_user_name: GitHub Actions commit_user_email: actions@github.com