From 28050adbcb075decf604c3997da24f682cf812ca Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sun, 15 Sep 2024 14:08:09 +0100 Subject: [PATCH 01/34] lint and action updates --- .github/workflows/e2e.yml | 6 +++--- .github/workflows/pr_checks.yml | 7 +++---- .github/workflows/publish-docker.yml | 6 ++++-- .github/workflows/publish-infra.yml | 7 ++++--- .github/workflows/release.yml | 5 ++--- .github/workflows/typecheck.yml | 6 ++++-- .github/workflows/unit-tests.yml | 9 +++++---- 7 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 905b4991c9..edef353d28 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,4 +1,5 @@ name: "E2E" + on: workflow_call: inputs: @@ -7,6 +8,7 @@ on: default: webapp required: false type: string + jobs: cli-v3: name: "๐Ÿงช CLI v3 tests (${{ matrix.os }} - ${{ matrix.package-manager }})" @@ -19,7 +21,7 @@ jobs: package-manager: ["npm", "pnpm", "yarn"] steps: - name: โฌ‡๏ธ Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -50,5 +52,3 @@ jobs: shell: bash run: | LOG=debug PM=${{ matrix.package-manager }} pnpm --filter trigger.dev run test:e2e - - diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index e579843270..298c0766ff 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -30,12 +30,11 @@ jobs: preview-release: name: Preview Release needs: [typecheck, units, e2e] - if: | - github.repository == 'triggerdotdev/trigger.dev' + if: github.repository == 'triggerdotdev/trigger.dev' runs-on: buildjet-8vcpu-ubuntu-2204 steps: - name: โฌ‡๏ธ Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -56,5 +55,5 @@ jobs: - name: ๐Ÿ—๏ธ Build run: pnpm run build --filter "@trigger.dev/*" --filter "trigger.dev" - - name: โšก publish preview release + - name: โšก Publish preview release run: npx pkg-pr-new publish --no-template $(ls -d ./packages/*) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 688b1d25db..cd0bc3f4c5 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -1,6 +1,8 @@ name: "๐Ÿณ Publish Docker" + on: workflow_call: + jobs: publish: runs-on: ubuntu-latest @@ -14,7 +16,7 @@ jobs: uses: depot/setup-action@v1 - name: โฌ‡๏ธ Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive @@ -59,7 +61,7 @@ jobs: echo "IMAGE_TAGS=${image_tags}" >> "$GITHUB_OUTPUT" - name: ๐Ÿ™ Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} diff --git a/.github/workflows/publish-infra.yml b/.github/workflows/publish-infra.yml index 1a3486b018..ca9dd885dd 100644 --- a/.github/workflows/publish-infra.yml +++ b/.github/workflows/publish-infra.yml @@ -42,7 +42,8 @@ jobs: env: DOCKER_BUILDKIT: "1" steps: - - uses: actions/checkout@v4 + - name: โฌ‡๏ธ Checkout git repo + uses: actions/checkout@v4 - name: Generate image reference id: prep @@ -80,11 +81,11 @@ jobs: fi echo "IMAGE_TAG=${image_tag}" >> "$GITHUB_OUTPUT" - - name: Set up Docker Buildx + - name: ๐Ÿ‹ Set up Docker Buildx uses: docker/setup-buildx-action@v3 # ..to avoid rate limits when pulling images - - name: Login to DockerHub + - name: ๐Ÿณ Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c196ddfb64..2a10f8c384 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,8 +14,7 @@ jobs: release: name: ๐Ÿฆ‹ Changesets Release runs-on: buildjet-8vcpu-ubuntu-2204 - if: | - github.repository == 'triggerdotdev/trigger.dev' + if: github.repository == 'triggerdotdev/trigger.dev' outputs: published_packages: ${{ steps.changesets.outputs.publishedPackages }} published: ${{ steps.changesets.outputs.published }} @@ -24,7 +23,7 @@ jobs: uses: styfle/cancel-workflow-action@0.11.0 - name: โฌ‡๏ธ Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index afc5cf03a9..921e9bd342 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -1,13 +1,15 @@ name: "สฆ TypeScript" + on: workflow_call: + jobs: typecheck: runs-on: buildjet-8vcpu-ubuntu-2204 steps: - name: โฌ‡๏ธ Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -30,6 +32,6 @@ jobs: - name: ๐Ÿ”Ž Type check run: pnpm run typecheck - + - name: ๐Ÿ”Ž Check exports run: pnpm run check-exports diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 111c3b0378..863c5fcde5 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,13 +1,15 @@ name: "๐Ÿงช Unit Tests" + on: workflow_call: + jobs: unitTests: name: "๐Ÿงช Unit Tests" runs-on: buildjet-8vcpu-ubuntu-2204 steps: - name: โฌ‡๏ธ Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -25,6 +27,5 @@ jobs: - name: ๐Ÿ“ฅ Download deps run: pnpm install --frozen-lockfile - - name: Run Unit Tests - run: | - pnpm run test + - name: ๐Ÿงช Run Unit Tests + run: pnpm run test From 107b888b9a19665abc2f0a4d671cceea098d547d Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sun, 15 Sep 2024 14:11:04 +0100 Subject: [PATCH 02/34] add custom image tag action --- .github/actions/get-image-tag/action.yml | 38 +++++++++++++++++++++ .github/workflows/publish-docker.yml | 36 +++++--------------- .github/workflows/publish-infra.yml | 42 ++++++------------------ 3 files changed, 57 insertions(+), 59 deletions(-) create mode 100644 .github/actions/get-image-tag/action.yml diff --git a/.github/actions/get-image-tag/action.yml b/.github/actions/get-image-tag/action.yml new file mode 100644 index 0000000000..87bdba19eb --- /dev/null +++ b/.github/actions/get-image-tag/action.yml @@ -0,0 +1,38 @@ +name: "#๏ธโƒฃ Get image tag (action)" + +description: This action gets the image tag from the commit ref or input (if provided) + +outputs: + tag: + description: The image tag + value: ${{ steps.get_tag.outputs.tag }} + +runs: + using: "composite" + steps: + - name: "#๏ธโƒฃ Get image tag (step)" + id: get_tag + shell: bash + run: | + if [[ "${{ github.ref_type }}" == "tag" ]]; then + if [[ "${{ github.ref_name }}" == infra-*-* ]]; then + env=$(echo ${{ github.ref_name }} | cut -d- -f2) + sha=$(echo ${{ github.sha }} | head -c7) + ts=$(date +%s) + tag=${env}-${sha}-${ts} + elif [[ "${{ github.ref_name }}" == v.docker.* ]]; then + version="${GITHUB_REF_NAME#v.docker.}" + tag="v${version}" + elif [[ "${{ github.ref_name }}" == build-* ]]; then + tag="${GITHUB_REF_NAME#build-}" + else + echo "Invalid tag: ${{ github.ref_name }}" + exit 1 + fi + elif [[ "${{ github.ref_name }}" == "main" ]]; then + tag="main" + else + echo "Invalid reference: ${{ github.ref }}" + exit 1 + fi + echo "tag=${tag}" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index cd0bc3f4c5..c95d683f1d 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -9,7 +9,7 @@ jobs: env: PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING: 1 outputs: - version: ${{ steps.get_version.outputs.version }} + version: ${{ steps.get_tag.outputs.tag }} short_sha: ${{ steps.get_commit.outputs.sha_short }} steps: - name: Setup Depot CLI @@ -20,45 +20,27 @@ jobs: with: submodules: recursive - - name: ๐Ÿ†š Get the version - id: get_version - run: | - IMAGE_TAG="${GITHUB_REF#refs/tags/}" - if [[ $GITHUB_REF == refs/tags/* ]]; then - if [[ $IMAGE_TAG == v.docker.* ]]; then - ORIGINAL_VERSION="${IMAGE_TAG#v.docker.}" - IMAGE_TAG="v${ORIGINAL_VERSION}" - elif [[ $IMAGE_TAG == build-* ]]; then - IMAGE_TAG="${IMAGE_TAG#build-}" - fi - echo "IMAGE_TAG=${IMAGE_TAG}" - elif [[ $GITHUB_REF == refs/heads/main ]]; then - # Handle main branch specifically - IMAGE_TAG="main" - echo "IMAGE_TAG=${IMAGE_TAG}" - else - echo "Invalid reference: ${GITHUB_REF}" - exit 1 - fi - echo "::set-output name=version::${IMAGE_TAG}" + - name: "#๏ธโƒฃ Get the image tag" + id: get_tag + uses: ./.github/actions/get-image-tag - name: ๐Ÿ”ข Get the commit hash id: get_commit run: | - echo ::set-output name=sha_short::$(echo ${{ github.sha }} | cut -c1-7) + echo "sha_short=$(echo ${{ github.sha }} | cut -c1-7)" >> "$GITHUB_OUTPUT" - name: ๐Ÿ“› Set the tags id: set_tags run: | ref_without_tag=ghcr.io/triggerdotdev/trigger.dev - image_tags=$ref_without_tag:${{ steps.get_version.outputs.version }} + image_tags=$ref_without_tag:${{ steps.get_tag.outputs.tag }} # if it's a versioned tag, also tag it as v3 if [[ "${{ github.ref_name }}" == v.docker.* ]]; then image_tags=$image_tags,$ref_without_tag:v3 fi - - echo "IMAGE_TAGS=${image_tags}" >> "$GITHUB_OUTPUT" + + echo "image_tags=${image_tags}" >> "$GITHUB_OUTPUT" - name: ๐Ÿ™ Login to GitHub Container Registry uses: docker/login-action@v3 @@ -72,5 +54,5 @@ jobs: with: file: ./docker/Dockerfile platforms: linux/amd64,linux/arm64 - tags: ${{ steps.set_tags.outputs.IMAGE_TAGS }} + tags: ${{ steps.set_tags.outputs.image_tags }} push: true diff --git a/.github/workflows/publish-infra.yml b/.github/workflows/publish-infra.yml index ca9dd885dd..c9d3e77754 100644 --- a/.github/workflows/publish-infra.yml +++ b/.github/workflows/publish-infra.yml @@ -45,41 +45,19 @@ jobs: - name: โฌ‡๏ธ Checkout git repo uses: actions/checkout@v4 - - name: Generate image reference - id: prep + - name: ๐Ÿ“ฆ Get image repo + id: get_repository run: | - # set image repo if [[ "${{ matrix.package }}" == *-provider ]]; then provider_type=$(echo "${{ matrix.package }}" | cut -d- -f1) - repository=provider/${provider_type} + repo=provider/${provider_type} else - repository="${{ matrix.package }}" + repo="${{ matrix.package }}" fi - echo "REPOSITORY=${repository}" >> "$GITHUB_OUTPUT" + echo "repo=${repo}" >> "$GITHUB_OUTPUT" - # set image tag - if [[ "${{ github.ref_type }}" == "tag" ]]; then - if [[ "${{ github.ref_name }}" == infra-*-* ]]; then - env=$(echo ${{ github.ref_name }} | cut -d- -f2) - sha=$(echo ${{ github.sha }} | head -c7) - ts=$(date +%s) - image_tag=${env}-${sha}-${ts} - elif [[ "${{ github.ref_name }}" == v.docker.* ]]; then - version="${GITHUB_REF_NAME#v.docker.}" - image_tag="v${version}" - elif [[ "${{ github.ref_name }}" == build-* ]]; then - image_tag="${GITHUB_REF_NAME#build-}" - else - echo "Invalid tag: ${{ github.ref_name }}" - exit 1 - fi - elif [[ "${{ github.ref_name }}" == "main" ]]; then - image_tag="main" - else - echo "Invalid reference: ${{ github.ref }}" - exit 1 - fi - echo "IMAGE_TAG=${image_tag}" >> "$GITHUB_OUTPUT" + - id: get_tag + uses: ./.github/actions/get-image-tag - name: ๐Ÿ‹ Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -109,8 +87,8 @@ jobs: docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG env: REGISTRY: ghcr.io/triggerdotdev - REPOSITORY: ${{ steps.prep.outputs.REPOSITORY }} - IMAGE_TAG: ${{ steps.prep.outputs.IMAGE_TAG }} + REPOSITORY: ${{ steps.get_repository.outputs.repo }} + IMAGE_TAG: ${{ steps.get_tag.outputs.tag }} - name: ๐Ÿ™ Push 'v3' tag to GitHub Container Registry if: startsWith(github.ref_name, 'v.docker.') @@ -119,4 +97,4 @@ jobs: docker push $REGISTRY/$REPOSITORY:v3 env: REGISTRY: ghcr.io/triggerdotdev - REPOSITORY: ${{ steps.prep.outputs.REPOSITORY }} + REPOSITORY: ${{ steps.get_repository.outputs.repo }} From fee02a49e9cbd0dc5b40e6c7b394475ed59f694e Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sun, 15 Sep 2024 14:12:26 +0100 Subject: [PATCH 03/34] remove publish infra bloat --- .github/workflows/publish-infra.yml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/.github/workflows/publish-infra.yml b/.github/workflows/publish-infra.yml index c9d3e77754..89a7f50bb0 100644 --- a/.github/workflows/publish-infra.yml +++ b/.github/workflows/publish-infra.yml @@ -7,32 +7,11 @@ on: - "infra-dev-*" - "infra-test-*" - "infra-prod-*" - paths: - - ".github/workflows/publish.yml" - - "packages/**" - - "!packages/**/*.md" - - "!packages/**/*.eslintrc" - - "apps/**" - - "!apps/**/*.md" - - "!apps/**/*.eslintrc" - - "integrations/**" - - "!integrations/**/*.md" - - "!integrations/**/*.eslintrc" - - "pnpm-lock.yaml" - - "pnpm-workspace.yaml" - - "turbo.json" - - "docker/Dockerfile" - - "docker/scripts/**" - - "tests/**" permissions: - id-token: write packages: write contents: read -env: - AWS_REGION: us-east-1 - jobs: build: strategy: From b2d1c3f3f2243f27c282859b1ac1da9cad05ee92 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:23:46 +0100 Subject: [PATCH 04/34] replace cancel action with native concurrency control --- .github/workflows/release.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a10f8c384..2239f18f9a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,10 @@ on: - ".github/CODEOWNERS" - ".github/ISSUE_TEMPLATE/**" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: release: name: ๐Ÿฆ‹ Changesets Release @@ -19,9 +23,6 @@ jobs: published_packages: ${{ steps.changesets.outputs.publishedPackages }} published: ${{ steps.changesets.outputs.published }} steps: - - name: ๐Ÿ›‘ Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - - name: โฌ‡๏ธ Checkout repo uses: actions/checkout@v4 with: From 90f2f78e044b2d9e1e6f9c990f2ddbe3e3caa3ea Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:28:02 +0100 Subject: [PATCH 05/34] ignore all docs changes for release trigger --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2239f18f9a..8b00694513 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,8 +5,8 @@ on: branches: - main paths-ignore: + - "docs/**" - "**.md" - - "**.mdx" - ".github/CODEOWNERS" - ".github/ISSUE_TEMPLATE/**" From f58df38ae897b1478cb57d678af07ebe52ba55ef Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:29:14 +0100 Subject: [PATCH 06/34] image action updates --- .github/actions/get-image-tag/action.yml | 41 +++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/.github/actions/get-image-tag/action.yml b/.github/actions/get-image-tag/action.yml index 87bdba19eb..a0078850fb 100644 --- a/.github/actions/get-image-tag/action.yml +++ b/.github/actions/get-image-tag/action.yml @@ -6,6 +6,15 @@ outputs: tag: description: The image tag value: ${{ steps.get_tag.outputs.tag }} + is_semver: + description: Whether the tag is a semantic version + value: ${{ steps.check_semver.outputs.is_semver }} + +inputs: + tag: + description: The image tag. If this is set it will return the tag as is. + required: false + default: "" runs: using: "composite" @@ -14,7 +23,9 @@ runs: id: get_tag shell: bash run: | - if [[ "${{ github.ref_type }}" == "tag" ]]; then + if [[ -n "${{ inputs.tag }}" ]]; then + tag="${{ inputs.tag }}" + elif [[ "${{ github.ref_type }}" == "tag" ]]; then if [[ "${{ github.ref_name }}" == infra-*-* ]]; then env=$(echo ${{ github.ref_name }} | cut -d- -f2) sha=$(echo ${{ github.sha }} | head -c7) @@ -36,3 +47,31 @@ runs: exit 1 fi echo "tag=${tag}" >> "$GITHUB_OUTPUT" + + - name: ๐Ÿ” Check for validity + id: check_validity + shell: bash + env: + tag: ${{ steps.get_tag.outputs.tag }} + run: | + if [[ "${tag}" =~ ^[a-z0-9]+([._-][a-z0-9]+)*$ ]]; then + echo "Tag is valid: ${tag}" + else + echo "Tag is not valid: ${tag}" + exit 1 + fi + + - name: ๐Ÿ†š Check for semver + id: check_semver + shell: bash + env: + tag: ${{ steps.get_tag.outputs.tag }} + run: | + if [[ "${tag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+)?$ ]]; then + echo "Tag is a semantic version: ${tag}" + is_semver=true + else + echo "Tag is not a semantic version: ${tag}" + is_semver=false + fi + echo "is_semver=${is_semver}" >> "$GITHUB_OUTPUT" From eef94fac3c9f6cb31ce18260967b5cecfd4eec6e Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:31:10 +0100 Subject: [PATCH 07/34] update publish trigger paths --- .github/workflows/publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fa48190727..89a96e18f7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,11 +8,13 @@ on: - "v.docker.*" - "build-*" paths: + - ".github/actions/**/*.yml" - ".github/workflows/publish.yml" - ".github/workflows/typecheck.yml" - ".github/workflows/unit-tests.yml" - ".github/workflows/e2e.yml" - ".github/workflows/publish-docker.yml" + - ".github/workflows/publish-infra.yml" - "packages/**" - "!packages/**/*.md" - "!packages/**/*.eslintrc" From 8518b6f6e57b1b8b80ae009538c5e2625139fa50 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:34:28 +0100 Subject: [PATCH 08/34] simplify semver checks --- .github/workflows/publish-docker.yml | 4 ++-- .github/workflows/publish-infra.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index c95d683f1d..7a6d946a24 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -35,8 +35,8 @@ jobs: ref_without_tag=ghcr.io/triggerdotdev/trigger.dev image_tags=$ref_without_tag:${{ steps.get_tag.outputs.tag }} - # if it's a versioned tag, also tag it as v3 - if [[ "${{ github.ref_name }}" == v.docker.* ]]; then + # if tag is a semver, also tag it as v3 + if [[ "${{ steps.get_tag.outputs.is_semver }}" == true ]]; then image_tags=$image_tags,$ref_without_tag:v3 fi diff --git a/.github/workflows/publish-infra.yml b/.github/workflows/publish-infra.yml index 89a7f50bb0..502d4347f9 100644 --- a/.github/workflows/publish-infra.yml +++ b/.github/workflows/publish-infra.yml @@ -70,7 +70,7 @@ jobs: IMAGE_TAG: ${{ steps.get_tag.outputs.tag }} - name: ๐Ÿ™ Push 'v3' tag to GitHub Container Registry - if: startsWith(github.ref_name, 'v.docker.') + if: steps.get_tag.outputs.is_semver == 'true' run: | docker tag infra_image $REGISTRY/$REPOSITORY:v3 docker push $REGISTRY/$REPOSITORY:v3 From ce949094a48ccc364448f238059e60f072a6f697 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sun, 15 Sep 2024 21:53:51 +0100 Subject: [PATCH 09/34] make it possible to call publish --- .github/workflows/publish-docker.yml | 10 +++++++++- .github/workflows/publish-infra.yml | 8 ++++++++ .github/workflows/publish.yml | 10 ++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 7a6d946a24..6c0a4315dd 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -2,6 +2,12 @@ name: "๐Ÿณ Publish Docker" on: workflow_call: + inputs: + image_tag: + description: The image tag to publish + type: string + required: false + default: "" jobs: publish: @@ -12,7 +18,7 @@ jobs: version: ${{ steps.get_tag.outputs.tag }} short_sha: ${{ steps.get_commit.outputs.sha_short }} steps: - - name: Setup Depot CLI + - name: ๐Ÿญ Setup Depot CLI uses: depot/setup-action@v1 - name: โฌ‡๏ธ Checkout repo @@ -23,6 +29,8 @@ jobs: - name: "#๏ธโƒฃ Get the image tag" id: get_tag uses: ./.github/actions/get-image-tag + with: + tag: ${{ github.event.inputs.image_tag }} - name: ๐Ÿ”ข Get the commit hash id: get_commit diff --git a/.github/workflows/publish-infra.yml b/.github/workflows/publish-infra.yml index 502d4347f9..57ac4b857e 100644 --- a/.github/workflows/publish-infra.yml +++ b/.github/workflows/publish-infra.yml @@ -2,6 +2,12 @@ name: "๐Ÿšข Publish Infra Images" on: workflow_call: + inputs: + image_tag: + description: The image tag to publish + type: string + required: false + default: "" push: tags: - "infra-dev-*" @@ -37,6 +43,8 @@ jobs: - id: get_tag uses: ./.github/actions/get-image-tag + with: + tag: ${{ github.event.inputs.image_tag }} - name: ๐Ÿ‹ Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 89a96e18f7..a60a026a32 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,12 @@ name: ๐Ÿš€ Publish Trigger.dev Docker on: + workflow_call: + inputs: + image_tag: + description: The image tag to publish + required: true + type: string push: branches: - main @@ -55,8 +61,12 @@ jobs: needs: [typecheck, units] uses: ./.github/workflows/publish-docker.yml secrets: inherit + with: + image_tag: ${{ github.event.inputs.image_tag }} publish-infra: needs: [typecheck, units] uses: ./.github/workflows/publish-infra.yml secrets: inherit + with: + image_tag: ${{ github.event.inputs.image_tag }} From cb87cb565ca23162e801f23a5b6fd3b83b12ca59 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sun, 15 Sep 2024 21:55:08 +0100 Subject: [PATCH 10/34] add tests for custom action --- .github/workflows/test-actions.yml | 152 +++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 .github/workflows/test-actions.yml diff --git a/.github/workflows/test-actions.yml b/.github/workflows/test-actions.yml new file mode 100644 index 0000000000..895025b858 --- /dev/null +++ b/.github/workflows/test-actions.yml @@ -0,0 +1,152 @@ +name: Test Actions + +on: + workflow_dispatch: + +jobs: + get-image-tag-none: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log current ref + run: | + echo "ref: ${{ github.ref }}" + echo "ref_type: ${{ github.ref_type }}" + echo "ref_name: ${{ github.ref_name }}" + + - name: Run without input tag + id: get_tag + # this step may fail depending on the current ref + continue-on-error: true + uses: ./.github/actions/get-image-tag + + - name: Verify output + run: | + echo "${{ toJson(steps.get_tag) }}" + + get-image-tag-null: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log current ref + run: | + echo "ref: ${{ github.ref }}" + echo "ref_type: ${{ github.ref_type }}" + echo "ref_name: ${{ github.ref_name }}" + + - name: Run without input tag + id: get_tag + uses: ./.github/actions/get-image-tag + # this step may fail depending on the current ref + continue-on-error: true + with: + # this should behave exactly as when no tag is provided + tag: null + + - name: Verify output + run: | + echo "${{ toJson(steps.get_tag) }}" + + get-image-tag-override: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run with tag override + id: get_tag + uses: ./.github/actions/get-image-tag + with: + tag: "abc-123" + + - name: Verify output + run: | + echo "${{ toJson(steps.get_tag) }}" + + get-image-tag-invalid-string: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run with invalid string + id: get_tag + uses: ./.github/actions/get-image-tag + # this step is expected to fail + continue-on-error: true + with: + # does not end with alphanumeric character + tag: "abc-123-" + + - name: Fail job if previous step did not fail + if: steps.get_tag.outcome != 'failure' + run: exit 1 + + - name: Verify output + run: | + echo "${{ toJson(steps.get_tag) }}" + + get-image-tag-prerelease: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run with prerelease semver + id: get_tag + uses: ./.github/actions/get-image-tag + with: + tag: "v1.2.3-beta.4" + + - name: Verify output + run: | + echo "${{ toJson(steps.get_tag) }}" + + get-image-tag-semver: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run with basic semver + id: get_tag + uses: ./.github/actions/get-image-tag + with: + tag: "v1.2.3" + + - name: Verify output + run: | + echo "${{ toJson(steps.get_tag) }}" + + get-image-tag-invalid-semver: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run with invalid semver + id: get_tag + uses: ./.github/actions/get-image-tag + # this step is expected to fail + continue-on-error: true + with: + tag: "v1.2.3-" + + - name: Fail job if previous step did not fail + if: steps.get_tag.outcome != 'failure' + run: exit 1 + + - name: Verify output + run: | + echo "${{ toJson(steps.get_tag) }}" From d5b916777dcae53d9220c814605189cc7156a885 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sun, 15 Sep 2024 22:04:30 +0100 Subject: [PATCH 11/34] rename publish workflows --- .../{publish-docker.yml => publish-webapp.yml} | 2 +- .../{publish-infra.yml => publish-worker.yml} | 2 +- .github/workflows/publish.yml | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) rename .github/workflows/{publish-docker.yml => publish-webapp.yml} (98%) rename .github/workflows/{publish-infra.yml => publish-worker.yml} (98%) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-webapp.yml similarity index 98% rename from .github/workflows/publish-docker.yml rename to .github/workflows/publish-webapp.yml index 6c0a4315dd..8e3af048db 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-webapp.yml @@ -1,4 +1,4 @@ -name: "๐Ÿณ Publish Docker" +name: "๐Ÿณ Publish Webapp" on: workflow_call: diff --git a/.github/workflows/publish-infra.yml b/.github/workflows/publish-worker.yml similarity index 98% rename from .github/workflows/publish-infra.yml rename to .github/workflows/publish-worker.yml index 57ac4b857e..224c604d2a 100644 --- a/.github/workflows/publish-infra.yml +++ b/.github/workflows/publish-worker.yml @@ -1,4 +1,4 @@ -name: "๐Ÿšข Publish Infra Images" +name: "๐Ÿšข Publish Worker" on: workflow_call: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a60a026a32..63c3d0a9ae 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,8 +19,8 @@ on: - ".github/workflows/typecheck.yml" - ".github/workflows/unit-tests.yml" - ".github/workflows/e2e.yml" - - ".github/workflows/publish-docker.yml" - - ".github/workflows/publish-infra.yml" + - ".github/workflows/publish-webapp.yml" + - ".github/workflows/publish-worker.yml" - "packages/**" - "!packages/**/*.md" - "!packages/**/*.eslintrc" @@ -57,16 +57,16 @@ jobs: uses: ./.github/workflows/unit-tests.yml secrets: inherit - publish: + publish-webapp: needs: [typecheck, units] - uses: ./.github/workflows/publish-docker.yml + uses: ./.github/workflows/publish-webapp.yml secrets: inherit with: image_tag: ${{ github.event.inputs.image_tag }} - publish-infra: + publish-worker: needs: [typecheck, units] - uses: ./.github/workflows/publish-infra.yml + uses: ./.github/workflows/publish-worker.yml secrets: inherit with: image_tag: ${{ github.event.inputs.image_tag }} From d36f0476e400c69cd0fd4d06321e4432a971e36d Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sun, 15 Sep 2024 22:25:13 +0100 Subject: [PATCH 12/34] call publish after successful package release --- .github/workflows/release.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8b00694513..a5af6a8b54 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,8 +20,9 @@ jobs: runs-on: buildjet-8vcpu-ubuntu-2204 if: github.repository == 'triggerdotdev/trigger.dev' outputs: - published_packages: ${{ steps.changesets.outputs.publishedPackages }} published: ${{ steps.changesets.outputs.published }} + published_packages: ${{ steps.changesets.outputs.publishedPackages }} + published_package_version: ${{ steps.get_version.outputs.package_version }} steps: - name: โฌ‡๏ธ Checkout repo uses: actions/checkout@v4 @@ -73,3 +74,18 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: ๐Ÿ“ฆ Get package version + if: steps.changesets.outputs.published == 'true' + id: get_version + run: | + package_version=$(echo ${{ steps.changesets.outputs.publishedPackages }} | jq '.[0].version') + echo "package_version=${package_version}" >> "$GITHUB_OUTPUT" + + publish: + needs: release + uses: ./.github/workflows/publish.yml + secrets: inherit + if: needs.release.outputs.published == 'true' + with: + image_tag: v${{ needs.release.outputs.published_package_version }} From 5df1b7e331acca0669f14c3e998f5950fbbc83a9 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 08:17:59 +0100 Subject: [PATCH 13/34] fix inputs and published package parsing --- .github/workflows/publish-webapp.yml | 2 +- .github/workflows/publish-worker.yml | 4 ++-- .github/workflows/publish.yml | 4 ++-- .github/workflows/release.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-webapp.yml b/.github/workflows/publish-webapp.yml index 8e3af048db..b977ef0a19 100644 --- a/.github/workflows/publish-webapp.yml +++ b/.github/workflows/publish-webapp.yml @@ -30,7 +30,7 @@ jobs: id: get_tag uses: ./.github/actions/get-image-tag with: - tag: ${{ github.event.inputs.image_tag }} + tag: ${{ inputs.image_tag }} - name: ๐Ÿ”ข Get the commit hash id: get_commit diff --git a/.github/workflows/publish-worker.yml b/.github/workflows/publish-worker.yml index 224c604d2a..a2e59bbb88 100644 --- a/.github/workflows/publish-worker.yml +++ b/.github/workflows/publish-worker.yml @@ -1,4 +1,4 @@ -name: "๐Ÿšข Publish Worker" +name: "โš’๏ธ Publish Worker" on: workflow_call: @@ -44,7 +44,7 @@ jobs: - id: get_tag uses: ./.github/actions/get-image-tag with: - tag: ${{ github.event.inputs.image_tag }} + tag: ${{ inputs.image_tag }} - name: ๐Ÿ‹ Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 63c3d0a9ae..b11cb18622 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -62,11 +62,11 @@ jobs: uses: ./.github/workflows/publish-webapp.yml secrets: inherit with: - image_tag: ${{ github.event.inputs.image_tag }} + image_tag: ${{ inputs.image_tag }} publish-worker: needs: [typecheck, units] uses: ./.github/workflows/publish-worker.yml secrets: inherit with: - image_tag: ${{ github.event.inputs.image_tag }} + image_tag: ${{ inputs.image_tag }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a5af6a8b54..bd3a58440e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,7 +79,7 @@ jobs: if: steps.changesets.outputs.published == 'true' id: get_version run: | - package_version=$(echo ${{ steps.changesets.outputs.publishedPackages }} | jq '.[0].version') + package_version=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[0].version') echo "package_version=${package_version}" >> "$GITHUB_OUTPUT" publish: From 483162a8256e24164cfd7d283cac72d13b64528e Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 08:30:41 +0100 Subject: [PATCH 14/34] clarify image tag action errors --- .github/actions/get-image-tag/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/get-image-tag/action.yml b/.github/actions/get-image-tag/action.yml index a0078850fb..760e718295 100644 --- a/.github/actions/get-image-tag/action.yml +++ b/.github/actions/get-image-tag/action.yml @@ -37,13 +37,13 @@ runs: elif [[ "${{ github.ref_name }}" == build-* ]]; then tag="${GITHUB_REF_NAME#build-}" else - echo "Invalid tag: ${{ github.ref_name }}" + echo "Invalid git tag: ${{ github.ref_name }}" exit 1 fi elif [[ "${{ github.ref_name }}" == "main" ]]; then tag="main" else - echo "Invalid reference: ${{ github.ref }}" + echo "Invalid git ref: ${{ github.ref }}" exit 1 fi echo "tag=${tag}" >> "$GITHUB_OUTPUT" From d2d0716ed83cdde961aff43b713fc093e2e836fa Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 08:36:32 +0100 Subject: [PATCH 15/34] move test action --- .github/{workflows => test}/test-actions.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{workflows => test}/test-actions.yml (100%) diff --git a/.github/workflows/test-actions.yml b/.github/test/test-actions.yml similarity index 100% rename from .github/workflows/test-actions.yml rename to .github/test/test-actions.yml From db06c774778b98cc350c01ac2054ef0bfcf79096 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 08:36:49 +0100 Subject: [PATCH 16/34] add test events --- .github/test/events/push-main.json | 3 +++ .github/test/events/push-tag-build.json | 3 +++ .github/test/events/push-tag-docker-nonsemver.json | 3 +++ .github/test/events/push-tag-docker.json | 3 +++ .github/test/events/push-tag-infra-prod.json | 3 +++ .github/test/events/push-tag-infra-test.json | 3 +++ .github/test/events/push-tag-semver.json | 3 +++ .github/test/events/push-tag.json | 3 +++ 8 files changed, 24 insertions(+) create mode 100644 .github/test/events/push-main.json create mode 100644 .github/test/events/push-tag-build.json create mode 100644 .github/test/events/push-tag-docker-nonsemver.json create mode 100644 .github/test/events/push-tag-docker.json create mode 100644 .github/test/events/push-tag-infra-prod.json create mode 100644 .github/test/events/push-tag-infra-test.json create mode 100644 .github/test/events/push-tag-semver.json create mode 100644 .github/test/events/push-tag.json diff --git a/.github/test/events/push-main.json b/.github/test/events/push-main.json new file mode 100644 index 0000000000..ccb4cb1c17 --- /dev/null +++ b/.github/test/events/push-main.json @@ -0,0 +1,3 @@ +{ + "ref": "refs/heads/main" +} diff --git a/.github/test/events/push-tag-build.json b/.github/test/events/push-tag-build.json new file mode 100644 index 0000000000..9490c181ab --- /dev/null +++ b/.github/test/events/push-tag-build.json @@ -0,0 +1,3 @@ +{ + "ref": "refs/tags/build-buildtag" +} diff --git a/.github/test/events/push-tag-docker-nonsemver.json b/.github/test/events/push-tag-docker-nonsemver.json new file mode 100644 index 0000000000..5ce2d8dcf3 --- /dev/null +++ b/.github/test/events/push-tag-docker-nonsemver.json @@ -0,0 +1,3 @@ +{ + "ref": "refs/tags/v.docker.nonsemver" +} diff --git a/.github/test/events/push-tag-docker.json b/.github/test/events/push-tag-docker.json new file mode 100644 index 0000000000..7b55610ca2 --- /dev/null +++ b/.github/test/events/push-tag-docker.json @@ -0,0 +1,3 @@ +{ + "ref": "refs/tags/v.docker.1.2.3" +} diff --git a/.github/test/events/push-tag-infra-prod.json b/.github/test/events/push-tag-infra-prod.json new file mode 100644 index 0000000000..7d4bb3a0bb --- /dev/null +++ b/.github/test/events/push-tag-infra-prod.json @@ -0,0 +1,3 @@ +{ + "ref": "refs/tags/infra-prod-anything" +} diff --git a/.github/test/events/push-tag-infra-test.json b/.github/test/events/push-tag-infra-test.json new file mode 100644 index 0000000000..78eeefbe41 --- /dev/null +++ b/.github/test/events/push-tag-infra-test.json @@ -0,0 +1,3 @@ +{ + "ref": "refs/tags/infra-test-anything" +} diff --git a/.github/test/events/push-tag-semver.json b/.github/test/events/push-tag-semver.json new file mode 100644 index 0000000000..3fb65c9207 --- /dev/null +++ b/.github/test/events/push-tag-semver.json @@ -0,0 +1,3 @@ +{ + "ref": "refs/tags/1.2.3" +} diff --git a/.github/test/events/push-tag.json b/.github/test/events/push-tag.json new file mode 100644 index 0000000000..26496f8087 --- /dev/null +++ b/.github/test/events/push-tag.json @@ -0,0 +1,3 @@ +{ + "ref": "refs/tags/standard-tag" +} From 19f4a3cccf944b371d7a42cf5a187d0a85db9593 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:42:38 +0100 Subject: [PATCH 17/34] add changesets action mock --- .github/workflows/release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd3a58440e..c1c39512a8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,6 +63,7 @@ jobs: # PR is merged, the workflow will run again and this action will build + # publish to npm. - name: ๐Ÿš€ PR / Publish + if: ${{ !env.ACT }} id: changesets uses: changesets/action@v1 with: @@ -75,6 +76,13 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: ๐Ÿš€ PR / Publish (mock) + if: ${{ env.ACT }} + id: changesets + run: | + echo "published=true" >> "$GITHUB_OUTPUT" + echo "publishedPackages=[{\"name\": \"@xx/xx\", \"version\": \"1.2.0\"}, {\"name\": \"@xx/xy\", \"version\": \"0.8.9\"}]" >> "$GITHUB_OUTPUT" + - name: ๐Ÿ“ฆ Get package version if: steps.changesets.outputs.published == 'true' id: get_version From 404e18cb522277c57ee66d7d770fdcd46b3974fe Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 13:50:07 +0100 Subject: [PATCH 18/34] add docs checks --- .github/workflows/docs.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000000..cec05ea171 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,27 @@ +name: ๐Ÿ“š Docs Checks + +on: + push: + pull_request: + paths: + - "docs/**" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + check-broken-links: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./docs + steps: + - name: ๐Ÿ“ฅ Checkout repository + uses: actions/checkout@v3 + + - name: ๐Ÿ”— Check for broken links + run: npx mintlify broken-links From 7c57d0e2aaa94dcf23ca12bcf6433a5f446c7285 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 13:56:53 +0100 Subject: [PATCH 19/34] add github action test readme --- .github/test/README.md | 70 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/test/README.md diff --git a/.github/test/README.md b/.github/test/README.md new file mode 100644 index 0000000000..1e8383fda5 --- /dev/null +++ b/.github/test/README.md @@ -0,0 +1,70 @@ +# GitHub Action Tests + +This directory contains necessary files to allow local testing of GitHub Actions workflows, composite actions, etc. You will need to install [act](https://github.com/nektos/act) to perform tests. + +## Workflow tests + +Trigger specific workflow files by specifying their full path: + +``` +act -W .github/workflow/release.yml +``` + +You will likely need to override any custom runners we use, e.g. buildjet. For example: + +``` +override=catthehacker/ubuntu:act-latest + +act -W .github/workflow/release.yml \ + -P buildjet-8vcpu-ubuntu-2204=$override + +# override multiple images at the same time +act -W .github/workflow/release.yml \ + -P buildjet-8vcpu-ubuntu-2204=$override \ + -P buildjet-16vcpu-ubuntu-2204=$override +``` + +Trigger with specific event payloads to test pushing to branches or tags: + +``` +override=catthehacker/ubuntu:act-latest + +# simulate push to main +act -W .github/workflow/publish.yml \ + -P buildjet-8vcpu-ubuntu-2204=$override \ + -P buildjet-16vcpu-ubuntu-2204=$override \ + -e .github/events/push-tag-main.json + +# simulate a `build-` prefixed tag +act -W .github/workflow/publish.yml \ + -P buildjet-8vcpu-ubuntu-2204=$override \ + -P buildjet-16vcpu-ubuntu-2204=$override \ + -e .github/events/push-tag-buld.json +``` + +By default, `act` will send a push event. To trigger a different event: + +``` +# basic syntax +act ... + +# simulate a pull request +act pull_request + +# only trigger a specific workflow +act pull_request -W .github/workflow/pr_checks.yml +``` + +## Composite action tests + +The composite (custom) action tests can be run by triggering the `test-actions` workflow: + +``` +act -W .github/test/test-actions.yml +``` + +## Helpful flags + +- `--pull=false` - perform fully offline tests if all images are already present +- `-j ` - run the specified job only +- `-l push` - list all workflows with push triggers From ca14c6972f4d8df23aca15efbfa1559d3e58265a Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:00:18 +0100 Subject: [PATCH 20/34] fix docs check on push --- .github/workflows/docs.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cec05ea171..9a8f04130a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,7 +2,10 @@ name: ๐Ÿ“š Docs Checks on: push: + paths: + - "docs/**" pull_request: + types: [opened, synchronize, reopened] paths: - "docs/**" From bee7a77cbd2f29081da356b6c1d1f066ee499b81 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:01:50 +0100 Subject: [PATCH 21/34] update action versions in docs --- docs/github-actions.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/github-actions.mdx b/docs/github-actions.mdx index 1a9206ea39..c47db4adf0 100644 --- a/docs/github-actions.mdx +++ b/docs/github-actions.mdx @@ -27,7 +27,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js 20.x uses: actions/setup-node@v4 @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js 20.x uses: actions/setup-node@v4 From acab9a866a21525be859aa747b25341ad12ea791 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:08:46 +0100 Subject: [PATCH 22/34] cache npm for docs check --- .github/workflows/docs.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9a8f04130a..5352defa2a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -26,5 +26,13 @@ jobs: - name: ๐Ÿ“ฅ Checkout repository uses: actions/checkout@v3 + - name: ๐Ÿ“ฆ Cache npm + uses: actions/cache@v3 + with: + path: | + ~/.npm + ~/.cache + key: ${{ runner.os }}-mintlify + - name: ๐Ÿ”— Check for broken links - run: npx mintlify broken-links + run: npx mintlify@4.0.222 broken-links From ef7e3d9d70d89fd59d93c2d6729a0e36014e1b33 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:09:16 +0100 Subject: [PATCH 23/34] pretend to fix bad docs link --- .../frameworks/supabase-edge-functions-database-webhooks.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx b/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx index 4780966c3b..b1fc350876 100644 --- a/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx +++ b/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx @@ -140,7 +140,7 @@ Add a new column called `name` with the type `text`. -By default, Supabase edge functions require a JSON Web Token ([JWT](<(https://supabase.com/docs/guides/auth/jwts)>)) in the authorization header. This is to ensure that only authorized users can access your edge functions. +By default, Supabase edge functions require a JSON Web Token [JWT](<(https://supabase.com/docs/guides/auth/jwts)>) in the authorization header. This is to ensure that only authorized users can access your edge functions. In your Supabase project dashboard, click 'Project settings' , then the 'API' tab , and copy the `anon` `public` API key from the table . From a7508f5d55ce8806def24cb5c1d838b85ce8670a Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:11:10 +0100 Subject: [PATCH 24/34] fix docs link --- .../frameworks/supabase-edge-functions-database-webhooks.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx b/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx index b1fc350876..e11b9067c5 100644 --- a/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx +++ b/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx @@ -140,7 +140,7 @@ Add a new column called `name` with the type `text`. -By default, Supabase edge functions require a JSON Web Token [JWT](<(https://supabase.com/docs/guides/auth/jwts)>) in the authorization header. This is to ensure that only authorized users can access your edge functions. +By default, Supabase edge functions require a JSON Web Token [JWT](https://supabase.com/docs/guides/auth/jwts) in the authorization header. This is to ensure that only authorized users can access your edge functions. In your Supabase project dashboard, click 'Project settings' , then the 'API' tab , and copy the `anon` `public` API key from the table . From ec642af3dccc144009023c5fac7e5da0740c8154 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:15:12 +0100 Subject: [PATCH 25/34] Revert "fix docs link" This reverts commit a7508f5d55ce8806def24cb5c1d838b85ce8670a. --- .../frameworks/supabase-edge-functions-database-webhooks.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx b/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx index e11b9067c5..b1fc350876 100644 --- a/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx +++ b/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx @@ -140,7 +140,7 @@ Add a new column called `name` with the type `text`. -By default, Supabase edge functions require a JSON Web Token [JWT](https://supabase.com/docs/guides/auth/jwts) in the authorization header. This is to ensure that only authorized users can access your edge functions. +By default, Supabase edge functions require a JSON Web Token [JWT](<(https://supabase.com/docs/guides/auth/jwts)>) in the authorization header. This is to ensure that only authorized users can access your edge functions. In your Supabase project dashboard, click 'Project settings' , then the 'API' tab , and copy the `anon` `public` API key from the table . From 698b244d5178adaadb82b6d49addfecf56ff4aaf Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:16:41 +0100 Subject: [PATCH 26/34] Revert "Revert "fix docs link"" This reverts commit ec642af3dccc144009023c5fac7e5da0740c8154. --- .../frameworks/supabase-edge-functions-database-webhooks.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx b/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx index b1fc350876..e11b9067c5 100644 --- a/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx +++ b/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx @@ -140,7 +140,7 @@ Add a new column called `name` with the type `text`. -By default, Supabase edge functions require a JSON Web Token [JWT](<(https://supabase.com/docs/guides/auth/jwts)>) in the authorization header. This is to ensure that only authorized users can access your edge functions. +By default, Supabase edge functions require a JSON Web Token [JWT](https://supabase.com/docs/guides/auth/jwts) in the authorization header. This is to ensure that only authorized users can access your edge functions. In your Supabase project dashboard, click 'Project settings' , then the 'API' tab , and copy the `anon` `public` API key from the table . From 066ed5a5524683325727b7d6a2708f88cea6f7b2 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:29:38 +0100 Subject: [PATCH 27/34] improve caching --- .github/workflows/docs.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5352defa2a..62f67dceaf 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -31,8 +31,10 @@ jobs: with: path: | ~/.npm - ~/.cache - key: ${{ runner.os }}-mintlify + key: | + ${{ runner.os }}-mintlify + restore-keys: | + ${{ runner.os }}-mintlify - name: ๐Ÿ”— Check for broken links run: npx mintlify@4.0.222 broken-links From 07e15afd9879a9b0d69256457367537996a2ddf9 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 23 Sep 2024 12:44:04 +0100 Subject: [PATCH 28/34] disable automatic publishing after release --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index af0400a3bf..9926a2ede7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -94,6 +94,8 @@ jobs: needs: release uses: ./.github/workflows/publish.yml secrets: inherit - if: needs.release.outputs.published == 'true' + # if: needs.release.outputs.published == 'true' + # disable automatic publishing for now + if: false with: image_tag: v${{ needs.release.outputs.published_package_version }} From 0910b7158dd072a47b69d90a977badc98d76a50d Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 23 Sep 2024 12:57:27 +0100 Subject: [PATCH 29/34] limit docs checks to pushes to main and PRs --- .github/workflows/docs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 62f67dceaf..5faa87cccf 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,6 +2,8 @@ name: ๐Ÿ“š Docs Checks on: push: + branches: + - main paths: - "docs/**" pull_request: From aded2982481a56fcfd8cd63ffc72e5ee839869d7 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 23 Sep 2024 13:40:46 +0100 Subject: [PATCH 30/34] fix broken links --- docs/config/config-file.mdx | 4 ++-- docs/errors-retrying.mdx | 4 ++-- docs/examples/ffmpeg-video-processing.mdx | 2 +- docs/guides/dashboard/creating-a-project.mdx | 2 +- docs/how-it-works.mdx | 2 +- docs/introduction.mdx | 6 +++--- docs/migration-defer.mdx | 4 ++-- docs/mint.json | 4 ++++ docs/quick-start.mdx | 2 +- docs/snippets/useful-next-steps.mdx | 2 +- docs/tasks-regular.mdx | 2 +- docs/tasks/scheduled.mdx | 2 +- docs/triggering.mdx | 4 ++-- docs/writing-tasks-introduction.mdx | 2 +- 14 files changed, 23 insertions(+), 19 deletions(-) diff --git a/docs/config/config-file.mdx b/docs/config/config-file.mdx index 6613314104..44866a8083 100644 --- a/docs/config/config-file.mdx +++ b/docs/config/config-file.mdx @@ -70,7 +70,7 @@ export default defineConfig({ }); ``` -Read more about task lifecycle functions in the [tasks overview](/tasks-overview). +Read more about task lifecycle functions in the [tasks overview](/tasks/overview). ## Instrumentations @@ -116,7 +116,7 @@ export default defineConfig({ }); ``` -See our [Bun guide](/guides/bun) for more information. +See our [Bun guide](/guides/frameworks/bun) for more information. ## Default machine diff --git a/docs/errors-retrying.mdx b/docs/errors-retrying.mdx index ea40d7bd5d..2a9fd3863b 100644 --- a/docs/errors-retrying.mdx +++ b/docs/errors-retrying.mdx @@ -9,12 +9,12 @@ When an uncaught error is thrown inside your task, that task attempt will fail. You can configure retrying in two ways: -1. In your [trigger.config file](/trigger-config) you can set the default retrying behavior for all tasks. +1. In your [trigger.config file](/config/config-file) you can set the default retrying behavior for all tasks. 2. On each task you can set the retrying behavior. By default when you create your project using the CLI init command we disabled retrying in the DEV - environment. You can enable it in your [trigger.config file](/trigger-config). + environment. You can enable it in your [trigger.config file](/config/config-file). ## A simple example with OpenAI diff --git a/docs/examples/ffmpeg-video-processing.mdx b/docs/examples/ffmpeg-video-processing.mdx index a5a33a0100..31ca6a8943 100644 --- a/docs/examples/ffmpeg-video-processing.mdx +++ b/docs/examples/ffmpeg-video-processing.mdx @@ -22,7 +22,7 @@ export default defineConfig({ ``` - [Build extensions](../guides/build-extensions) allow you to hook into the build system and + [Build extensions](/config/config-file#extensions) allow you to hook into the build system and customize the build process or the resulting bundle and container image (in the case of deploying). You can use pre-built extensions or create your own. diff --git a/docs/guides/dashboard/creating-a-project.mdx b/docs/guides/dashboard/creating-a-project.mdx index 73f04f63ee..2854ccbd32 100644 --- a/docs/guides/dashboard/creating-a-project.mdx +++ b/docs/guides/dashboard/creating-a-project.mdx @@ -30,7 +30,7 @@ description: "This guide will show you how to create a new Trigger.dev project." Setup Trigger.dev in 3 minutes - + Learn what tasks are and how to write them diff --git a/docs/how-it-works.mdx b/docs/how-it-works.mdx index 45de378b4c..a1eafc53bc 100644 --- a/docs/how-it-works.mdx +++ b/docs/how-it-works.mdx @@ -424,7 +424,7 @@ When you run `npx trigger.dev@latest dev`, we run your task code locally on your Trigger.dev currently does not support "offline" dev mode, where you can run tasks without an - internet connection. [Please let us know](feedback.trigger.dev) if this is a feature you + internet connection. [Please let us know](https://feedback.trigger.dev/) if this is a feature you want/need. diff --git a/docs/introduction.mdx b/docs/introduction.mdx index 1d1325ffbd..90d5d3732a 100644 --- a/docs/introduction.mdx +++ b/docs/introduction.mdx @@ -9,8 +9,8 @@ Trigger.dev v3 makes it easy to write reliable long-running tasks without timeou - We run your tasks with no timeouts. You don't have to manage any infrastructure (unless you [self-host](/open-source-self-hosting)). Workers are automatically scaled and managed for you. - We provide a multi-tenant queue that is used when triggering tasks. -- We provide an SDK and CLI for writing tasks in your existing codebase, inside [/trigger folders](/trigger-folder). -- We provide different types of tasks: [regular](/tasks-regular) and [scheduled](/tasks-scheduled). +- We provide an SDK and CLI for writing tasks in your existing codebase, inside [/trigger folders](/config/config-file). +- We provide different types of tasks: [regular](/tasks-regular) and [scheduled](/tasks/scheduled). - We provide a dashboard for monitoring, debugging, and managing your tasks. We're [open source](https://github.com/triggerdotdev/trigger.dev) and you can choose to use the [Trigger.dev Cloud](https://cloud.trigger.dev) or [Self-host Trigger.dev](/open-source-self-hosting) on your own infrastructure. @@ -21,7 +21,7 @@ We're [open source](https://github.com/triggerdotdev/trigger.dev) and you can ch Get started in 3 minutes. - + Tasks are the core of Trigger.dev. Learn what they are and how to write them. diff --git a/docs/migration-defer.mdx b/docs/migration-defer.mdx index 3ccc16587f..b40a29624f 100644 --- a/docs/migration-defer.mdx +++ b/docs/migration-defer.mdx @@ -242,7 +242,7 @@ export async function runLongRunningTask() { #### Example 2: A cron task -We call these [scheduled tasks](/tasks-scheduled) in Trigger.dev. +We call these [scheduled tasks](/tasks/scheduled) in Trigger.dev. In Defer you might have a function like this: @@ -272,6 +272,6 @@ export const sendMondayNewletter = schedules.task({ Then you need to attach a schedule to the task, either using the dashboard or in your code. You can attach unlimited schedules to a task. - + How to attach a schedule to a task diff --git a/docs/mint.json b/docs/mint.json index 1c7c35cb53..be73ca4cdc 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -83,6 +83,10 @@ { "source": "/trigger-folder", "destination": "/config/config-file" + }, + { + "source": "/trigger-config", + "destination": "/config/config-file" } ], "anchors": [ diff --git a/docs/quick-start.mdx b/docs/quick-start.mdx index 75f3d83a51..d6253bc269 100644 --- a/docs/quick-start.mdx +++ b/docs/quick-start.mdx @@ -47,7 +47,7 @@ Once you've created an account, follow the steps in the app to: Learn how to trigger tasks from your code. - + Tasks are the core of Trigger.dev. Learn what they are and how to write them. diff --git a/docs/snippets/useful-next-steps.mdx b/docs/snippets/useful-next-steps.mdx index 3ad1c44ac0..8fdb53af19 100644 --- a/docs/snippets/useful-next-steps.mdx +++ b/docs/snippets/useful-next-steps.mdx @@ -1,7 +1,7 @@ ## Useful next steps - + Learn what tasks are and their options diff --git a/docs/tasks-regular.mdx b/docs/tasks-regular.mdx index 91d3740c80..acc1be9021 100644 --- a/docs/tasks-regular.mdx +++ b/docs/tasks-regular.mdx @@ -7,7 +7,7 @@ import OpenaiRetry from "/snippets/code/openai-retry.mdx" They are defined using the `task()` function and can be [triggered](/triggering) from your backend or inside another task. -Like all tasks they don't have timeouts, they should be placed inside a [/trigger folder](/trigger-folder), and you [can configure them](/tasks-overview#defining-a-task). +Like all tasks they don't have timeouts, they should be placed inside a [/trigger folder](/config/config-file), and you [can configure them](/tasks/overview#defining-a-task). ## Example tasks diff --git a/docs/tasks/scheduled.mdx b/docs/tasks/scheduled.mdx index c9f7221735..da0d6dcb7d 100644 --- a/docs/tasks/scheduled.mdx +++ b/docs/tasks/scheduled.mdx @@ -60,7 +60,7 @@ You can see from the comments that the payload has several useful properties: to do that. -Like all tasks they don't have timeouts, they should be placed inside a [/trigger folder](/trigger-folder), and you [can configure them](/tasks-overview#defining-a-task). +Like all tasks they don't have timeouts, they should be placed inside a [/trigger folder](/config/config-file), and you [can configure them](/tasks/overview#defining-a-task). ## How to attach a schedule diff --git a/docs/triggering.mdx b/docs/triggering.mdx index d69bfd5df5..17c3dc32a4 100644 --- a/docs/triggering.mdx +++ b/docs/triggering.mdx @@ -20,11 +20,11 @@ Trigger tasks **from inside a run**: | `yourTask.triggerAndWait()` | Inside task | Triggers a task and then waits until it's complete. You get the result data to continue with. [Read more](#task-triggerandwait) | | `yourTask.batchTriggerAndWait()` | Inside task | Triggers a task multiple times in parallel and then waits until they're all complete. You get the resulting data to continue with. [Read more](#task-batchtriggerandwait) | -Additionally, [scheduled tasks](/tasks-scheduled) get **automatically** triggered on their schedule and webhooks when receiving a webhook. +Additionally, [scheduled tasks](/tasks/scheduled) get **automatically** triggered on their schedule and webhooks when receiving a webhook. ## Scheduled tasks -You should attach one or more schedules to your `schedules.task()` to trigger it on a recurring schedule. [Read the scheduled tasks docs](/tasks-scheduled). +You should attach one or more schedules to your `schedules.task()` to trigger it on a recurring schedule. [Read the scheduled tasks docs](/tasks/scheduled). ## Authentication diff --git a/docs/writing-tasks-introduction.mdx b/docs/writing-tasks-introduction.mdx index 03cbd5fdd6..f9a5d48b42 100644 --- a/docs/writing-tasks-introduction.mdx +++ b/docs/writing-tasks-introduction.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Introduction" description: "Tasks are the core of Trigger.dev. They are long-running processes that are triggered by events." --- -Before digging deeper into the details of writing tasks, you should read the [fundamentals of tasks](/tasks-overview) to understand what tasks are and how they work. +Before digging deeper into the details of writing tasks, you should read the [fundamentals of tasks](/tasks/overview) to understand what tasks are and how they work. ## Writing tasks From 65c7b89158f33d52a684eecb24a6655d3a07717f Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:02:28 +0100 Subject: [PATCH 31/34] prevent word splitting and globbing --- .github/workflows/publish-worker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-worker.yml b/.github/workflows/publish-worker.yml index a2e59bbb88..4593205d52 100644 --- a/.github/workflows/publish-worker.yml +++ b/.github/workflows/publish-worker.yml @@ -70,8 +70,8 @@ jobs: - name: ๐Ÿ™ Push to GitHub Container Registry run: | - docker tag infra_image $REGISTRY/$REPOSITORY:$IMAGE_TAG - docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG + docker tag infra_image "$REGISTRY/$REPOSITORY:$IMAGE_TAG" + docker push "$REGISTRY/$REPOSITORY:$IMAGE_TAG" env: REGISTRY: ghcr.io/triggerdotdev REPOSITORY: ${{ steps.get_repository.outputs.repo }} @@ -80,8 +80,8 @@ jobs: - name: ๐Ÿ™ Push 'v3' tag to GitHub Container Registry if: steps.get_tag.outputs.is_semver == 'true' run: | - docker tag infra_image $REGISTRY/$REPOSITORY:v3 - docker push $REGISTRY/$REPOSITORY:v3 + docker tag infra_image "$REGISTRY/$REPOSITORY:v3" + docker push "$REGISTRY/$REPOSITORY:v3" env: REGISTRY: ghcr.io/triggerdotdev REPOSITORY: ${{ steps.get_repository.outputs.repo }} From 2b5e085447249c5972bab586c622e944182b6247 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:02:48 +0100 Subject: [PATCH 32/34] use latest checkout action everywhere --- .github/test/test-actions.yml | 14 +++++++------- .github/workflows/docs.yml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/test/test-actions.yml b/.github/test/test-actions.yml index 895025b858..0d913ebc0e 100644 --- a/.github/test/test-actions.yml +++ b/.github/test/test-actions.yml @@ -9,7 +9,7 @@ jobs: continue-on-error: true steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Log current ref run: | @@ -32,7 +32,7 @@ jobs: continue-on-error: true steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Log current ref run: | @@ -58,7 +58,7 @@ jobs: continue-on-error: true steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run with tag override id: get_tag @@ -75,7 +75,7 @@ jobs: continue-on-error: true steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run with invalid string id: get_tag @@ -99,7 +99,7 @@ jobs: continue-on-error: true steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run with prerelease semver id: get_tag @@ -116,7 +116,7 @@ jobs: continue-on-error: true steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run with basic semver id: get_tag @@ -133,7 +133,7 @@ jobs: continue-on-error: true steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run with invalid semver id: get_tag diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5faa87cccf..853b6a8c4f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -26,7 +26,7 @@ jobs: working-directory: ./docs steps: - name: ๐Ÿ“ฅ Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: ๐Ÿ“ฆ Cache npm uses: actions/cache@v3 From 0dcf8f22ed4ed458d3303221327aaf98f4194479 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:25:27 +0100 Subject: [PATCH 33/34] correctly detect prereleases as valid semver --- .github/actions/get-image-tag/action.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/actions/get-image-tag/action.yml b/.github/actions/get-image-tag/action.yml index 760e718295..b9fc3e565b 100644 --- a/.github/actions/get-image-tag/action.yml +++ b/.github/actions/get-image-tag/action.yml @@ -66,8 +66,15 @@ runs: shell: bash env: tag: ${{ steps.get_tag.outputs.tag }} + # Will match most semver formats except build metadata, i.e. v1.2.3+build.1 + # Valid matches: + # v1.2.3 + # v1.2.3-alpha + # v1.2.3-alpha.1 + # v1.2.3-rc.1 + # v1.2.3-beta-1 run: | - if [[ "${tag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+)?$ ]]; then + if [[ "${tag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then echo "Tag is a semantic version: ${tag}" is_semver=true else From 30e94e23823e976dd81e05c5c27d81cc68d39477 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:28:58 +0100 Subject: [PATCH 34/34] update to latest cache action --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 853b6a8c4f..3abe5cb4fe 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@v4 - name: ๐Ÿ“ฆ Cache npm - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.npm