Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,23 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # The OIDC ID token is used for authentication with JSR.
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- uses: denoland/setup-deno@v1
with:
deno-version: v1.40
deno-version: v2.x
- name: Run tests
run: deno test test/**/*.test.ts

- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: "1.21"

- name: Bundle module and dependencies
run: deno bundle src/mod.ts bundle.js
go-version: "1.24"

- name: Install Apex CLI
run: deno install -A -f -n apex https://deno.land/x/apex_cli@v0.1.2/apex.ts
run: deno install -g -A --unstable-worker-options -f -n apex jsr:@apexlang/apex

- name: Install Protoc
run: |
Expand All @@ -59,3 +55,11 @@ jobs:
- name: Validate generated OpenAPI
run: find . -name 'openapi.yaml' -exec swagger-cli validate {} \;
working-directory: ./testdata

- name: Is Release?
if: startswith(github.ref, 'refs/tags/v')
run: echo "DEPLOY_PACKAGE=true" >> $GITHUB_ENV

- name: Publish to npm
if: env.DEPLOY_PACKAGE == 'true'
run: npx jsr publish
20 changes: 20 additions & 0 deletions .github/workflows/release.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function env(name: string): string {
const val = Deno.env.get(name);
if (!val) throw new Error(`$${name} is required`);
return val;
}

const version = env("VERSION");

if (!version.match(/^v\d+\.\d+\.\d+$/)) {
throw new Error("VERSION must be in the form v1.2.3");
}

console.log("Updating versions in files");

for (const file of ["jsr.json", "deno.json"]) {
console.log(`Updating ${file} for ${version}...`);
const orig = Deno.readTextFileSync(file);
const updated = orig.replace(/\d+\.\d+\.\d+/, version.substring(1));
Deno.writeFileSync(file, new TextEncoder().encode(updated));
}
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release apex version

on:
workflow_dispatch:
inputs:
version:
description: "Version to release"
required: true

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.RELEASE_TOKEN }}
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Update version and README.md
env:
VERSION: ${{ inputs.version }}
run: |
deno run --allow-run --allow-env --allow-write --allow-read ./.github/workflows/release.ts
- name: Commit and tag release
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: ${{ inputs.version }} release
tagging_message: ${{ inputs.version }}
- name: Create Release
uses: ncipollo/release-action@v1.12.0
with:
generateReleaseNotes: true
makeLatest: true
tag: ${{ inputs.version }}
37 changes: 37 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@apexlang/codegen",
"version": "0.1.10",
"description": "Code generators for Apex.",
"keywords": ["apex", "idl", "codegen"],
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://www.github.com/apexlang/codegen"
},
"bugs": {
"url": "https://www.github.com/apexlang/codegen/issues"
},
"imports": {
"@apexlang/apex": "jsr:@apexlang/apex@^0.2.0",
"@apexlang/core": "jsr:@apexlang/core@^0.2.0",
"@std/assert": "jsr:@std/assert@^1.0.11",
"@std/yaml": "jsr:@std/yaml@^1.0.5"
},
"exports": {
"./cs": "./src/cs/mod.ts",
"./go": "./src/go/mod.ts",
"./json-schema": "./src/json-schema/mod.ts",
"./markdown": "./src/markdown/mod.ts",
"./openapiv3": "./src/openapiv3/mod.ts",
"./proto": "./src/proto/mod.ts",
"./python": "./src/python/mod.ts",
"./rest": "./src/rest/mod.ts",
"./rust": "./src/rust/mod.ts",
"./typescript": "./src/typescript/mod.ts",
"./utils": "./src/utils/mod.ts"
},
"publish": {
"include": ["LICENSE", "README.md", "templates", "src/**/*.ts"],
"exclude": ["src/tests"]
}
}
242 changes: 242 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading