Skip to content

Commit

Permalink
🧹 Reusable workflows (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
janjakubnanista authored Nov 16, 2023
1 parent 3072368 commit 3d029ee
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 19 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/on-develop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-' `-`-' `-`-'
#
# Workflow that checks pull requests and branch pushes
# only enabled on development branches
#
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-' `-`-' `-`-'
name: Check code submission

on:
push:
# We have package publishing workflow running on main so this one is redundant
branches-ignore:
- "main"

# We want the workflow to stop and yield to a new run if new code is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
uses: ./.github/workflows/reusable-test.yaml
29 changes: 29 additions & 0 deletions .github/workflows/on-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-' `-`-' `-`-'
#
# Workflow that checks the code commited to the main branch
# and publishes the packages
#
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-' `-`-' `-`-'
name: Check & publish

on:
push:
branches:
- main

# We only want one workflow to run at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
check:
uses: ./.github/workflows/reusable-test.yaml

publish:
needs: check
uses: ./.github/workflows/reusable-publish.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-' `-`-' `-`-'
#
# Reusable workflow that builds the code and publishes the packages
#
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-' `-`-' `-`-'
name: Publish packages

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}
workflow_call:

# We'll default the NPM_TOKEN to an empty value since we use it
# in .npmrc file and if undefined, the node setup would fail
env:
NPM_TOKEN: ""

Expand Down Expand Up @@ -45,14 +52,10 @@ jobs:
restore-keys: |
${{ runner.os }}-turbo-
- name: Lint
run: yarn lint

- name: Build
run: yarn build

- name: Test
run: yarn test
env:
NODE_ENV: production

# This step uses the changesets CLI to bump the package versions and/or publish the unpublished packages
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-' `-`-' `-`-'
#
# Reusable workflow that runs the whole test suite, linter and build
#
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-' `-`-' `-`-'
name: Vape Tests

on:
push:
# We have package publishing workflow running on main so this one is redundant
branches-ignore:
- "main"

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

# We'll default the NPM_TOKEN to an empty value since we use it
# in .npmrc file and if undefined, the node setup would fail
env:
NPM_TOKEN: ""

Expand Down

0 comments on commit 3d029ee

Please sign in to comment.