Skip to content

Commit

Permalink
chore: add action workflows (#7)
Browse files Browse the repository at this point in the history
* chore: add github push workflow

* chore: add type-check and test to push workflow

* chore: add workflow for pull requests

* chore: update push and pull_request_target actions

* chore: add release action

* chore: rename actions
  • Loading branch information
PHILLIPS71 authored Apr 13, 2024
1 parent 2291f35 commit 6e1c6c4
Show file tree
Hide file tree
Showing 19 changed files with 311 additions and 121 deletions.
15 changes: 15 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: '🏗️ '
author: 'PHILLIPS71'

inputs:
COMMAND:
default: 'build'
required: true

runs:
using: 'composite'
steps:
- name: '🏗️ Build'
shell: bash
run: |
pnpm run ${{ inputs.COMMAND }}
15 changes: 15 additions & 0 deletions .github/actions/cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: '🔺️ '
author: 'PHILLIPS71'

runs:
using: 'composite'
steps:
- name: '🔺️ Cache (turbo)'
uses: actions/cache@v4
with:
path: .cache-turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
turbo-${{ github.job }}-
turbo-
27 changes: 27 additions & 0 deletions .github/actions/init/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: '💽️ '
author: 'PHILLIPS71'

inputs:
node-version:
default: '20'
description: '🔢 Node version'
required: true
pnpm-version:
default: '8'
description: '🔢 pnpm version'
required: true

runs:
using: 'composite'
steps:
- name: '🔧 pnpm'
uses: pnpm/action-setup@v3
with:
version: ${{ inputs.pnpm-version }}

- name: '💽️ Node ${{ inputs.node-version }}'
uses: actions/setup-node@v4
with:
cache-dependency-path: pnpm-lock.yaml
cache: 'pnpm'
node-version: ${{ inputs.node-version }}
10 changes: 10 additions & 0 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: '📦️ '
author: 'PHILLIPS71'

runs:
using: 'composite'
steps:
- name: '📦️ Dependencies'
shell: bash
run: |
pnpm install --frozen-lockfile
10 changes: 10 additions & 0 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: '🚨️ '
author: 'PHILLIPS71'

runs:
using: 'composite'
steps:
- name: '🚨️ Lint'
shell: bash
run: |
pnpm run lint
52 changes: 52 additions & 0 deletions .github/actions/release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: '🏷️ '
author: 'PHILLIPS71'

inputs:
RELEASE_TYPE:
required: true
RELEASE_IDENTIFIER:
required: false

runs:
using: 'composite'
steps:
- name: '🏷️ Release'
id: version
uses: giantnodes/semver@latest
with:
path: VERSION.txt
type: ${{ inputs.RELEASE_TYPE }}
identifier: ${{ inputs.RELEASE_IDENTIFIER }}

- name: '🏷️ Version @giantnodes/design-system'
shell: bash
run: |
pnpm version ${{ steps.version.outputs.version }} --no-git-tag-version
- name: '🏷️ Version @giantnodes/theme'
working-directory: packages/theme
shell: bash
run: |
pnpm version ${{ steps.version.outputs.version }} --no-git-tag-version
- name: '🏷️ Version @giantnodes/react'
working-directory: packages/react
shell: bash
run: |
pnpm version ${{ steps.version.outputs.version }} --no-git-tag-version
- name: '🏷️ Tag & Commit Release'
shell: bash
run: |
git checkout -b release/${{ steps.version.outputs.version }}
git commit -m 'chore(release): ${{ steps.version.outputs.version }}'
git tag ${{ steps.version.outputs.version }}
git push origin release/${{ steps.version.outputs.version }} --tags --force
- name: '🏷️ Open Pull Request'
uses: thomaseizinger/create-pull-request@master
with:
title: 'chore(release): ${{ steps.version.outputs.version }}'
github_token: ${{ secrets.GITHUB_TOKEN }}
head: release/${{ steps.version.outputs.version }}
base: main
15 changes: 15 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: '🧪 '
author: 'PHILLIPS71'

inputs:
COMMAND:
default: 'test'
required: true

runs:
using: 'composite'
steps:
- name: '🧪 Test'
shell: bash
run: |
pnpm run ${{ inputs.COMMAND }}
15 changes: 15 additions & 0 deletions .github/actions/type-check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: '🦺 '
author: 'PHILLIPS71'

inputs:
COMMAND:
default: 'type-check'
required: true

runs:
using: 'composite'
steps:
- name: '🦺 Type Check'
shell: bash
run: |
pnpm run ${{ inputs.COMMAND }}
101 changes: 0 additions & 101 deletions .github/workflows/main.yml

This file was deleted.

11 changes: 4 additions & 7 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name: pr-title
name: '📝 PR Title'

on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize
branches:
- main

jobs:
main:
name: 🏷️ PR Title
name: 📝 PR Title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: '🔀 Pull Request'

on:
pull_request_target:
branches:
- main

concurrency:
group: pull-request-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
pull:
name: '👷️ CI'
timeout-minutes: 20
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: '🐙️ Checkout'
uses: actions/checkout@v4

- name: '💽️ Init'
uses: ./.github/actions/init

- name: '📦 Install'
uses: ./.github/actions/install

- name: '🔺️ Cache (turbo)'
uses: ./.github/actions/cache

- name: '🏗️ Build'
uses: ./.github/actions/build
with:
COMMAND: 'build'

- name: '🚨️ Lint'
uses: ./.github/actions/lint

- name: '🦺 Type Check'
uses: ./.github/actions/type-check
with:
COMMAND: 'type-check'

- name: '🧪 Test'
uses: ./.github/actions/test
with:
COMMAND: 'test'
51 changes: 51 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: '▶️ Push'

on:
push:
branches:
- main
- chore/**
- feat/**
- fix/**

concurrency:
group: push-${{ github.ref }}
cancel-in-progress: true

jobs:
push:
name: '👷️ CI'
timeout-minutes: 20
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: '🐙️ Checkout'
uses: actions/checkout@v4

- name: '💽️ Init'
uses: ./.github/actions/init

- name: '📦 Install'
uses: ./.github/actions/install

- name: '🔺️ Cache (turbo)'
uses: ./.github/actions/cache

- name: '🏗️ Build'
uses: ./.github/actions/build
with:
COMMAND: 'build'

- name: '🚨️ Lint'
uses: ./.github/actions/lint

- name: '🦺 Type Check'
uses: ./.github/actions/type-check
with:
COMMAND: 'type-check'

- name: '🧪 Test'
uses: ./.github/actions/test
with:
COMMAND: 'test'
Loading

0 comments on commit 6e1c6c4

Please sign in to comment.