Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧹 Reusable workflows #21

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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