-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update planets validation/update actions
update planets/index.json use main planet registry
- Loading branch information
Showing
6 changed files
with
77 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as path from "jsr:@std/path"; | ||
|
||
import Ajv2019 from "npm:ajv/dist/2019.js"; | ||
import addFormats from "npm:ajv-formats"; | ||
|
||
const baseUrl = | ||
"https://planetarium.github.io/json-schema/NineChronicles/2024-12/"; | ||
const fetchJsonSchema = async (name) => | ||
await (await fetch(path.join(baseUrl, `/${name}.schema.json`))).json(); | ||
|
||
const ajv = new Ajv2019({ allErrors: true }); | ||
addFormats(ajv); | ||
|
||
ajv.addSchema(await fetchJsonSchema("PlanetSpec"), "PlanetSpec.schema.json"); | ||
|
||
const validate = ajv.compile(await fetchJsonSchema("PlanetRegistry")); | ||
|
||
for (const filename of Deno.args) { | ||
console.log(`validating ${filename}`); | ||
const valid = validate(JSON.parse(await Deno.readTextFile(filename))); | ||
if (!valid) { | ||
console.error(`Error validating ${filename}:`, validate.errors); | ||
Deno.exit(1); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Update planets config | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- planets/index.json | ||
branches: | ||
- main | ||
types: | ||
- closed | ||
|
||
jobs: | ||
validate-planets-config: | ||
if: github.event.pull_request.merged == true | ||
uses: ./.github/workflows/validate-planets.yaml | ||
update-planets-config: | ||
needs: [validate-planets-config] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-2 | ||
- run: | | ||
aws s3 cp planets/index.json s3://planets.nine-chronicles.com/planets/index.json | ||
aws cloudfront create-invalidation --distribution-id EP1JH2OWQMIKM --paths "/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Validate planets config | ||
|
||
on: | ||
workflow_call: | ||
pull_request: | ||
paths: | ||
- planets/index.json | ||
|
||
jobs: | ||
validate-planets-config: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: denoland/setup-deno@v2 | ||
with: | ||
deno-version: v2.x | ||
- run: deno -A .github/scripts/validate-planets.js planets/index.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.