ci: use concurrency

This commit is contained in:
iCrawl
2022-08-16 11:00:17 +02:00
parent e82b2e49f5
commit 501945215b
5 changed files with 24 additions and 11 deletions

View File

@@ -3,8 +3,6 @@ on:
push: push:
branches: branches:
- 'main' - 'main'
- 'stable'
- '!docs'
tags: tags:
- '**' - '**'
workflow_dispatch: workflow_dispatch:
@@ -12,6 +10,16 @@ on:
ref: ref:
description: 'The branch, tag or SHA to checkout' description: 'The branch, tag or SHA to checkout'
required: true required: true
ref_type:
type: choice
description: 'Branch or tag'
options:
- branch
- tag
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs: jobs:
build: build:
name: Build documentation name: Build documentation
@@ -77,7 +85,7 @@ jobs:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
BRANCH_NAME: ${{ github.event.inputs.ref || needs.build.outputs.BRANCH_NAME }} BRANCH_NAME: ${{ github.event.inputs.ref || needs.build.outputs.BRANCH_NAME }}
BRANCH_OR_TAG: ${{ needs.build.outputs.BRANCH_OR_TAG }} BRANCH_OR_TAG: ${{ github.event.inputs.ref_type || needs.build.outputs.BRANCH_OR_TAG }}
SHA: ${{ needs.build.outputs.SHA }} SHA: ${{ needs.build.outputs.SHA }}
steps: steps:
- name: Checkout repository - name: Checkout repository
@@ -115,14 +123,14 @@ jobs:
path: 'out' path: 'out'
- name: Extract package and semver from tag - name: Extract package and semver from tag
if: ${{ github.event.inputs.ref || env.BRANCH_OR_TAG == 'tag' }} if: ${{ github.event.inputs.ref_type === 'tag' || env.BRANCH_OR_TAG == 'tag' }}
id: extract-tag id: extract-tag
uses: ./packages/actions/src/formatTag uses: ./packages/actions/src/formatTag
with: with:
tag: ${{ env.BRANCH_NAME }} tag: ${{ env.BRANCH_NAME }}
- name: Move docs to correct directory - name: Move docs to correct directory
if: ${{ (github.event.inputs.ref || env.BRANCH_OR_TAG == 'tag') && matrix.package == steps.extract-tag.outputs.package }} if: ${{ (github.event.inputs.ref_type == 'tag' || env.BRANCH_OR_TAG == 'tag') && matrix.package == steps.extract-tag.outputs.package }}
env: env:
PACKAGE: ${{ steps.extract-tag.outputs.package }} PACKAGE: ${{ steps.extract-tag.outputs.package }}
SEMVER: ${{ steps.extract-tag.outputs.semver }} SEMVER: ${{ steps.extract-tag.outputs.semver }}
@@ -134,7 +142,7 @@ jobs:
fi fi
- name: Move docs to correct directory - name: Move docs to correct directory
if: ${{ !github.event.inputs.ref && env.BRANCH_OR_TAG == 'branch' }} if: ${{ !github.event.inputs.ref_type == 'branch' && env.BRANCH_OR_TAG == 'branch' }}
env: env:
PACKAGE: ${{ matrix.package }} PACKAGE: ${{ matrix.package }}
run: | run: |

View File

@@ -1,8 +1,8 @@
name: npm auto deprecate name: npm auto deprecate
on: on:
workflow_dispatch:
schedule: schedule:
- cron: '0 1 * * *' - cron: '0 1 * * *'
workflow_dispatch:
jobs: jobs:
npm-auto-deprecate: npm-auto-deprecate:
name: npm auto deprecate name: npm auto deprecate

View File

@@ -1,8 +1,8 @@
name: Publish dev docker images name: Publish dev docker images
on: on:
workflow_dispatch:
schedule: schedule:
- cron: '0 */12 * * *' - cron: '0 */12 * * *'
workflow_dispatch:
jobs: jobs:
docker-publish: docker-publish:
name: Docker publish name: Docker publish

View File

@@ -1,8 +1,8 @@
name: Publish dev name: Publish dev
on: on:
workflow_dispatch:
schedule: schedule:
- cron: '0 */12 * * *' - cron: '0 */12 * * *'
workflow_dispatch:
jobs: jobs:
npm-publish: npm-publish:
name: npm publish name: npm publish

View File

@@ -1,5 +1,10 @@
name: Tests name: Tests
on: [push, pull_request] on:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs: jobs:
tests: tests:
name: Tests name: Tests
@@ -31,5 +36,5 @@ jobs:
run: yarn test run: yarn test
- name: Upload Coverage - name: Upload Coverage
uses: ./packages/actions/src/uploadCoverage
if: github.repository_owner == 'discordjs' if: github.repository_owner == 'discordjs'
uses: ./packages/actions/src/uploadCoverage