From 04c3cdb385569405850acb7adb4828a349b4a6b0 Mon Sep 17 00:00:00 2001 From: AbstractionFactory <179820029+abstractionfactory@users.noreply.github.com> Date: Fri, 30 Aug 2024 14:38:28 +0200 Subject: [PATCH] Manual generation workflow Signed-off-by: AbstractionFactory <179820029+abstractionfactory@users.noreply.github.com> --- .github/workflows/generate-manual.yml | 52 +++++++++++++++++++++++++++ .github/workflows/generate.yml | 4 ++- README.md | 2 ++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/generate-manual.yml diff --git a/.github/workflows/generate-manual.yml b/.github/workflows/generate-manual.yml new file mode 100644 index 00000000..21426240 --- /dev/null +++ b/.github/workflows/generate-manual.yml @@ -0,0 +1,52 @@ +name: Generate (manual) +permissions: {} +on: + workflow_dispatch: + inputs: + namespace: + description: "Namespace to regenerate" + required: true + type: string + name: + description: "Name of the provider or module to regenerate" + required: false + type: string + default: "" + target_system: + description: "Target system of the module to regenerate" + required: false + type: string + default: "" + force_regenerate: + type: string + required: false + default: "" + description: "Force regenerating a namespace, name, or target system. This parameter is a comma-separate list consisting of either a namespace, a namespace and a name separated by a /, or a namespace, name and target system separated by a /. Example: namespace/name/targetsystem,othernamespace/othername" +concurrency: + group: generate + cancel-in-progress: false +jobs: + generate: + name: Run generation + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version-file: 'backend/go.mod' + - name: Run generation + working-directory: backend + env: + AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}} + AWS_ENDPOINT_URL_S3: ${{secrets.AWS_ENDPOINT_URL_S3}} + AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}} + S3_BUCKET: ${{secrets.S3_BUCKET}} + NAMESPACE: ${{inputs.namespace}} + NAME: ${{inputs.name}} + TARGET_SYSTEM: ${{inputs.target_system}} + FORCE_REGENERATE: ${{inputs.force_regenerate}} + run: | + go generate ./... + go run github.com/opentofu/registry-ui/cmd/generate --log-level=trace --s3-bucket=${S3_BUCKET} --blocklist ../blocklist.json --namespace="${NAMESPACE}" --name="${NAME}" --target-system="${TARGET_SYSTEM}" --force-regenerate="${FORCE_REGENERATE}" diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 85cd4015..d9a5f7cb 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -1,9 +1,11 @@ name: Generate permissions: {} on: - workflow_dispatch: schedule: - cron: "0 * * * *" # Run every hour +concurrency: + group: generate + cancel-in-progress: false jobs: generate: name: Run generation diff --git a/README.md b/README.md index 599678d1..aa923041 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,8 @@ the following secrets to be set up: - `AWS_ENDPOINT_URL_S3` - `S3_BUCKET` +Additionally, the `Generate (manual)` workflow allows you to manually trigger the generation for a namespace, name, or target system, including an option to force the regeneration from scratch. + ## Frontend In order to run the frontend, enter the [frontend](frontend) directory and run `npm run dev`. You can create a `.env`