Skip to content

Commit 10fb88c

Browse files
committed
Release 0.3.0
1 parent c63fb39 commit 10fb88c

3 files changed

Lines changed: 32 additions & 48 deletions

File tree

.github/workflows/release.yml

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,65 @@
11
# Based on https://github.com/directus/eslint-config/blob/main/.github/workflows/release.yml
2+
# Version must already be bumped in package.json via a PR before running this workflow
23

34
name: Release
45

56
on:
6-
workflow_dispatch:
7-
inputs:
8-
version:
9-
description: SemVer for the release, for example "1.0.0"
10-
required: true
11-
type: string
7+
workflow_dispatch: {}
128

139
jobs:
14-
check-version:
15-
name: Check Version
10+
validate:
11+
name: Validate
1612
runs-on: ubuntu-latest
1713
outputs:
1814
version: ${{ steps.version.outputs.release }}
1915
is-prerelease: ${{ steps.version.outputs.prerelease && true || false }}
20-
steps:
21-
- name: Check version
22-
uses: madhead/semver-utils@v4
23-
id: version
24-
with:
25-
version: ${{ inputs.version }}
26-
lenient: false
27-
28-
validate:
29-
name: Validate
30-
needs: check-version
31-
runs-on: ubuntu-latest
3216
steps:
3317
- name: Checkout repository
3418
uses: actions/checkout@v4
3519

3620
- name: Setup env
3721
uses: ./.github/actions/setup
3822

23+
- name: Read version from package.json
24+
id: pkg-version
25+
run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT"
26+
27+
- name: Check version
28+
uses: madhead/semver-utils@v4
29+
id: version
30+
with:
31+
version: ${{ steps.pkg-version.outputs.version }}
32+
lenient: false
33+
3934
- name: Build
4035
run: pnpm run build
4136

42-
create-version:
43-
name: Create Version
44-
needs:
45-
- check-version
46-
- validate
37+
create-tag:
38+
name: Create Tag
39+
needs: validate
4740
runs-on: ubuntu-latest
4841
permissions:
4942
contents: write
5043
steps:
5144
- name: Checkout repository
5245
uses: actions/checkout@v4
5346

54-
- name: Setup env
55-
uses: ./.github/actions/setup
56-
57-
- name: Bump version
58-
run: pnpm version --no-git-tag-version '${{ needs.check-version.outputs.version }}'
59-
60-
- name: Create version commit & tag
47+
- name: Create tag
6148
run: |
62-
author='${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>'
63-
version='v${{ needs.check-version.outputs.version }}'
64-
branch='${{ github.ref }}'
49+
version='v${{ needs.validate.outputs.version }}'
6550
6651
git config user.name 'github-actions[bot]'
6752
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
6853
69-
git commit --all --author "$author" --message "$version"
70-
7154
git tag --annotate "$version" --message "$version"
7255
73-
git push --atomic origin "$branch" "refs/tags/${version}"
56+
git push origin "refs/tags/${version}"
7457
7558
create-release:
7659
name: Create Release
7760
needs:
78-
- check-version
79-
- create-version
61+
- validate
62+
- create-tag
8063
runs-on: ubuntu-latest
8164
permissions:
8265
contents: write
@@ -89,24 +72,24 @@ jobs:
8972
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9073
run: |
9174
gh release create \
92-
'v${{ needs.check-version.outputs.version }}' \
75+
'v${{ needs.validate.outputs.version }}' \
9376
--verify-tag \
9477
--generate-notes \
95-
${{ needs.check-version.outputs.is-prerelease == 'true' && '--prerelease' || '' }}
78+
${{ needs.validate.outputs.is-prerelease == 'true' && '--prerelease' || '' }}
9679
9780
publish-npm:
9881
name: Publish to NPM
9982
needs:
100-
- check-version
101-
- create-version
83+
- validate
84+
- create-tag
10285
runs-on: ubuntu-latest
10386
permissions:
10487
id-token: write
10588
steps:
10689
- name: Checkout repository
10790
uses: actions/checkout@v4
10891
with:
109-
ref: refs/tags/v${{ needs.check-version.outputs.version }}
92+
ref: refs/tags/v${{ needs.validate.outputs.version }}
11093

11194
- name: Setup env
11295
uses: ./.github/actions/setup
@@ -123,4 +106,4 @@ jobs:
123106
pnpm publish \
124107
--access=public \
125108
--no-git-checks \
126-
--tag ${{ needs.check-version.outputs.is-prerelease == 'true' && 'canary' || 'latest' }}
109+
--tag ${{ needs.validate.outputs.is-prerelease == 'true' && 'canary' || 'latest' }}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ Examples of how to use the equivalent of the documented REST endpoint in the JS
2828

2929
To deploy a new release to npm:
3030

31-
- Run the [release workflow](https://github.com/directus/openapi/actions/workflows/release.yml)
31+
1. Bump the version in `package.json` via a PR and merge it into `main`
32+
2. Run the [release workflow](https://github.com/directus/openapi/actions/workflows/release.yml)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@directus/openapi",
33
"private": false,
4-
"version": "0.2.2",
4+
"version": "0.3.0",
55
"description": "OpenAPI Specification of the Directus API",
66
"homepage": "https://directus.io",
77
"repository": {

0 commit comments

Comments
 (0)