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
3 changes: 0 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<!-- Title: type(scope): summary, for example "feat(backend): accept resource labels". See CONTRIBUTING.md. -->

## What and why

## How it was tested

- [ ] `npm test` passes in the root and in `backend/`
- [ ] The README is updated if behavior or the API changed
- [ ] A breaking change is marked with `!` in the title and described above
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

name: Build and test

on:
pull_request:
push:

permissions:
contents: read

jobs:
verify:
runs-on: ubuntu-latest
strategy:
matrix:
dir: [., backend]
defaults:
run:
working-directory: ${{ matrix.dir }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0

- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20
cache: npm
cache-dependency-path: ${{ matrix.dir }}/package-lock.json

- run: npm ci
- run: npm test
- run: npm run build
21 changes: 0 additions & 21 deletions .github/workflows/pr-title.yml

This file was deleted.

89 changes: 47 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,78 @@
name: Build and release
name: Release

on:
pull_request:
push:
branches: [main]
tags:
- 'v*'

permissions:
contents: read

jobs:
verify:
runs-on: ubuntu-latest
strategy:
matrix:
dir: [., backend]
defaults:
run:
working-directory: ${{ matrix.dir }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20
cache: npm
cache-dependency-path: ${{ matrix.dir }}/package-lock.json
- run: npm ci
- run: npm test
- run: npm run build

release:
if: github.event_name == 'push'
needs: verify
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
concurrency:
group: release
group: release-${{ github.ref }}
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
fetch-depth: 0

- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
registry-url: https://registry.npmjs.org
- name: Publish both packages and tag the release

- name: Get release version from tag
id: version
run: |
version=$(scripts/next-version.sh)
if [ -z "$version" ]; then
echo "Nothing to release since the last tag"
exit 0
tag="${GITHUB_REF_NAME}"
version="${tag#v}"

if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Invalid release tag: $tag. Expected vX.Y.Z."
Comment thread
colinjlacy marked this conversation as resolved.
Resolved
exit 1
fi

echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Releasing version $version"

- name: Publish both packages
env:
VERSION: ${{ steps.version.outputs.version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
for dir in . backend; do
name=$(npm pkg get name --prefix "$dir" | tr -d '"')
if npm view "$name@$version" version >/dev/null 2>&1; then
continue
fi
(
cd "$dir"

name=$(npm pkg get name | tr -d '"')

if npm view "$name@$VERSION" version >/dev/null 2>&1; then
echo "$name@$VERSION already published, skipping"
exit 0
fi

npm ci
npm version "$VERSION" --no-git-tag-version
npm pkg set main=dist/index.js types=dist/index.d.ts
npm run build
npm pkg set version="$version" main=dist/index.js types=dist/index.d.ts
npm publish
)
done
git tag "v$version"
git push origin "v$version"
(cd backend && npm ci && npm run openapi:generate -- "$version")
gh release create "v$version" backend/dist/openapi.yaml --generate-notes --verify-tag

- name: Generate OpenAPI specification
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
cd backend
npm ci
npm run openapi:generate -- "$VERSION"

- name: Create GitHub release
run: |
gh release create "$GITHUB_REF_NAME" backend/dist/openapi.yaml \
--generate-notes \
--verify-tag
62 changes: 0 additions & 62 deletions CONTRIBUTING.md

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Part of the Runtime Conditions org, https://github.com/runtimeconditions:

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).
See the [Runtime Conditions organization contributing guidelines](https://github.com/runtimeconditions/.github/blob/main/CONTRIBUTING.md).

## License

Expand Down
4 changes: 2 additions & 2 deletions backend/package-lock.json

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

2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runtimeconditions/plugin-runtime-conditions-backend",
"version": "0.1.0",
"version": "0.0.0",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runtimeconditions/plugin-runtime-conditions",
"version": "0.1.0",
"version": "0.0.0",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
28 changes: 0 additions & 28 deletions scripts/next-version.sh

This file was deleted.

Loading