Skip to content

Commit 75e9cac

Browse files
licitdevCopilot
andauthored
Release 0.3.0 (#60)
* Release 0.3.0 * Add main branch guard to release workflow validate job Agent-Logs-Url: https://github.com/directus/openapi/sessions/52d12eed-b043-4e6d-81d6-c9b2961b0f0b Co-authored-by: licitdev <26413686+licitdev@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: licitdev <26413686+licitdev@users.noreply.github.com>
1 parent c63fb39 commit 75e9cac

File tree

3 files changed

+33
-48
lines changed

3 files changed

+33
-48
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,66 @@
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
13+
if: github.ref == 'refs/heads/main'
1714
outputs:
1815
version: ${{ steps.version.outputs.release }}
1916
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
3217
steps:
3318
- name: Checkout repository
3419
uses: actions/checkout@v4
3520

3621
- name: Setup env
3722
uses: ./.github/actions/setup
3823

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

42-
create-version:
43-
name: Create Version
44-
needs:
45-
- check-version
46-
- validate
38+
create-tag:
39+
name: Create Tag
40+
needs: validate
4741
runs-on: ubuntu-latest
4842
permissions:
4943
contents: write
5044
steps:
5145
- name: Checkout repository
5246
uses: actions/checkout@v4
5347

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
48+
- name: Create tag
6149
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 }}'
50+
version='v${{ needs.validate.outputs.version }}'
6551
6652
git config user.name 'github-actions[bot]'
6753
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
6854
69-
git commit --all --author "$author" --message "$version"
70-
7155
git tag --annotate "$version" --message "$version"
7256
73-
git push --atomic origin "$branch" "refs/tags/${version}"
57+
git push origin "refs/tags/${version}"
7458
7559
create-release:
7660
name: Create Release
7761
needs:
78-
- check-version
79-
- create-version
62+
- validate
63+
- create-tag
8064
runs-on: ubuntu-latest
8165
permissions:
8266
contents: write
@@ -89,24 +73,24 @@ jobs:
8973
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9074
run: |
9175
gh release create \
92-
'v${{ needs.check-version.outputs.version }}' \
76+
'v${{ needs.validate.outputs.version }}' \
9377
--verify-tag \
9478
--generate-notes \
95-
${{ needs.check-version.outputs.is-prerelease == 'true' && '--prerelease' || '' }}
79+
${{ needs.validate.outputs.is-prerelease == 'true' && '--prerelease' || '' }}
9680
9781
publish-npm:
9882
name: Publish to NPM
9983
needs:
100-
- check-version
101-
- create-version
84+
- validate
85+
- create-tag
10286
runs-on: ubuntu-latest
10387
permissions:
10488
id-token: write
10589
steps:
10690
- name: Checkout repository
10791
uses: actions/checkout@v4
10892
with:
109-
ref: refs/tags/v${{ needs.check-version.outputs.version }}
93+
ref: refs/tags/v${{ needs.validate.outputs.version }}
11094

11195
- name: Setup env
11296
uses: ./.github/actions/setup
@@ -123,4 +107,4 @@ jobs:
123107
pnpm publish \
124108
--access=public \
125109
--no-git-checks \
126-
--tag ${{ needs.check-version.outputs.is-prerelease == 'true' && 'canary' || 'latest' }}
110+
--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)