diff --git a/.github/workflows/on-develop.yaml b/.github/workflows/on-develop.yaml new file mode 100644 index 000000000..24d1acb52 --- /dev/null +++ b/.github/workflows/on-develop.yaml @@ -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 diff --git a/.github/workflows/on-main.yaml b/.github/workflows/on-main.yaml new file mode 100644 index 000000000..3cbbe3bc2 --- /dev/null +++ b/.github/workflows/on-main.yaml @@ -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 diff --git a/.github/workflows/publish-packages.yaml b/.github/workflows/reusable-publish.yaml similarity index 77% rename from .github/workflows/publish-packages.yaml rename to .github/workflows/reusable-publish.yaml index 555739103..3e7a5846b 100644 --- a/.github/workflows/publish-packages.yaml +++ b/.github/workflows/reusable-publish.yaml @@ -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: "" @@ -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 # diff --git a/.github/workflows/vape-test.yml b/.github/workflows/reusable-test.yaml similarity index 66% rename from .github/workflows/vape-test.yml rename to .github/workflows/reusable-test.yaml index 8ba373e9a..3afb45d83 100644 --- a/.github/workflows/vape-test.yml +++ b/.github/workflows/reusable-test.yaml @@ -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: ""