Skip to content

Commit 6c697de

Browse files
authored
chore(ci): Create separate deliver workflow, rename build workflow (#618)
1 parent 5bde0a1 commit 6c697de

15 files changed

+388
-194
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"bump-minor-pre-major": true,
4+
"versioning": "always-bump-minor",
5+
"group-pull-request-title-pattern": "chore(${branch}): release ${version}",
6+
"packages": {
7+
".": {
8+
"release-type": "simple",
9+
"extra-files": [
10+
{
11+
"type": "generic",
12+
"path": "Makefile"
13+
},
14+
{
15+
"type": "json",
16+
"path": "cli/package.json",
17+
"jsonpath": "$.dependencies['@opentdf/sdk']"
18+
},
19+
{
20+
"type": "json",
21+
"path": "cli/package.json",
22+
"jsonpath": "$.version"
23+
},
24+
{
25+
"type": "json",
26+
"path": "web-app/package.json",
27+
"jsonpath": "$.dependencies['@opentdf/sdk']"
28+
},
29+
{
30+
"type": "json",
31+
"path": "web-app/package.json",
32+
"jsonpath": "$.version"
33+
},
34+
{
35+
"type": "json",
36+
"path": "web-app/package.json",
37+
"jsonpath": "$.scripts.rebuild"
38+
},
39+
{
40+
"type": "generic",
41+
"path": "lib/src/version.ts"
42+
},
43+
{
44+
"type": "json",
45+
"path": "lib/package.json",
46+
"jsonpath": "$.version"
47+
}
48+
]
49+
}
50+
}
51+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"bump-minor-pre-major": true,
4+
"versioning": "always-bump-patch",
5+
"group-pull-request-title-pattern": "chore(${branch}): release ${version}",
6+
"packages": {
7+
".": {
8+
"release-type": "simple",
9+
"extra-files": [
10+
{
11+
"type": "generic",
12+
"path": "Makefile"
13+
},
14+
{
15+
"type": "json",
16+
"path": "cli/package.json",
17+
"jsonpath": "$.dependencies['@opentdf/sdk']"
18+
},
19+
{
20+
"type": "json",
21+
"path": "cli/package.json",
22+
"jsonpath": "$.version"
23+
},
24+
{
25+
"type": "json",
26+
"path": "web-app/package.json",
27+
"jsonpath": "$.dependencies['@opentdf/sdk']"
28+
},
29+
{
30+
"type": "json",
31+
"path": "web-app/package.json",
32+
"jsonpath": "$.version"
33+
},
34+
{
35+
"type": "json",
36+
"path": "web-app/package.json",
37+
"jsonpath": "$.scripts.rebuild"
38+
},
39+
{
40+
"type": "generic",
41+
"path": "lib/src/version.ts"
42+
},
43+
{
44+
"type": "json",
45+
"path": "lib/package.json",
46+
"jsonpath": "$.version"
47+
}
48+
]
49+
}
50+
}
51+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.3.2"
3+
}

.github/workflows/backport.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Backport merged pull request"
2+
on:
3+
pull_request:
4+
types: [closed]
5+
issue_comment:
6+
types: [created]
7+
8+
# Default empty permissions for all jobs
9+
permissions: {}
10+
11+
jobs:
12+
backport:
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
id-token: write
17+
if: |
18+
(
19+
github.event_name == 'pull_request' &&
20+
github.event.pull_request.merged
21+
) || (
22+
github.event_name == 'issue_comment' &&
23+
github.event.issue.pull_request &&
24+
startsWith(github.event.comment.body, '/backport')
25+
)
26+
uses: opentdf/platform/.github/workflows/reusable_backport.yaml@main
27+
secrets:
28+
APP_ID: ${{ secrets.APP_ID }}
29+
AUTOMATION_KEY: ${{ secrets.AUTOMATION_KEY }}

.github/workflows/build.yaml renamed to .github/workflows/build-and-test.yaml

Lines changed: 13 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build, Test, and Deliver Client
1+
name: "Build and Test Client"
22

33
env:
44
do_sonarscan: >-
@@ -11,10 +11,7 @@ on:
1111
push:
1212
branches:
1313
- main
14-
- release/[0-9]+.[0-9]+.[0-9]+
15-
release:
16-
types:
17-
- created
14+
- "release/**"
1815
jobs:
1916
ccc:
2017
runs-on: ubuntu-latest
@@ -231,94 +228,6 @@ jobs:
231228
js-ref: ${{ github.ref }} latest lts
232229
platform-ref: main lts
233230

234-
deliver-ghp:
235-
needs:
236-
- lib
237-
- cli
238-
- web-app
239-
- scripts
240-
- platform-xtest
241-
runs-on: ubuntu-latest
242-
timeout-minutes: 5
243-
# To publish from a release or feature branch, remove the ref == condition below
244-
if: >-
245-
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
246-
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/')) ||
247-
(github.event_name == 'release' && startsWith(github.ref, 'refs/tags/'))
248-
outputs:
249-
FULL_VERSION: ${{ steps.guess-build-metadata.outputs.FULL_VERSION }}
250-
DIST_TAG: ${{ steps.guess-build-metadata.outputs.DIST_TAG }}
251-
TARGET_VERSION: ${{ steps.check-version.outputs.TARGET_VERSION }}
252-
steps:
253-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
254-
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e #v4.3.0
255-
with:
256-
node-version: '22'
257-
registry-url: https://npm.pkg.github.com
258-
- name: Check version number is same between tag, library, and/or release
259-
id: check-version
260-
run: |-
261-
if [[ ${{ github.ref }} = refs/heads/release/* ]]; then
262-
scripts/check-version-is.sh "${GITHUB_REF##*release/}"
263-
elif [[ ${{ github.ref }} = refs/tags/sdk/v* ]]; then
264-
scripts/check-version-is.sh "${GITHUB_REF_NAME#sdk/v}"
265-
else
266-
scripts/check-version-is.sh
267-
fi
268-
- name: Check version number is same between tag, library, and/or release
269-
id: guess-build-metadata
270-
run: |-
271-
echo "FULL_VERSION=$(.github/workflows/gh-semver.sh)" >> $GITHUB_OUTPUT
272-
echo "DIST_TAG=$(.github/workflows/guess-dist-tag.sh)" >> $GITHUB_OUTPUT
273-
- run: make doc
274-
- run: >-
275-
echo "::notice file=lib/package.json::Will be published to
276-
[GitHub Packages](https://github.com/opentdf/web-sdk/pkgs/npm/client)
277-
as ${{ steps.guess-build-metadata.outputs.DIST_TAG }}
278-
with version=[${{ steps.guess-build-metadata.outputs.FULL_VERSION }}]"
279-
- run: >-
280-
.github/workflows/publish-to.sh
281-
"${{ steps.guess-build-metadata.outputs.FULL_VERSION }}"
282-
"${{ steps.guess-build-metadata.outputs.DIST_TAG }}"
283-
env:
284-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
285-
- run: echo "- [Client Library](https://github.com/opentdf/web-sdk/pkgs/npm/client)">>$GITHUB_STEP_SUMMARY
286-
- run: echo "- [Command Line Tool](https://github.com/opentdf/web-sdk/pkgs/npm/cli)">>$GITHUB_STEP_SUMMARY
287-
- name: Publish documentation to gh-pages
288-
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 #v4.7.3
289-
with:
290-
branch: gh-pages
291-
folder: lib/dist/docs
292-
293-
deliver-npmjs:
294-
runs-on: ubuntu-latest
295-
timeout-minutes: 5
296-
environment: npmjs
297-
needs: deliver-ghp
298-
if: >-
299-
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
300-
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/')) ||
301-
(github.event_name == 'release' && startsWith(github.ref, 'refs/tags/sdk/v'))
302-
steps:
303-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
304-
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e #v4.3.0
305-
with:
306-
node-version: '22'
307-
registry-url: 'https://registry.npmjs.org'
308-
- run: make all
309-
- run: >-
310-
.github/workflows/publish-to.sh
311-
"${{ needs.deliver-ghp.outputs.FULL_VERSION }}"
312-
"${{ needs.deliver-ghp.outputs.DIST_TAG }}"
313-
env:
314-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
315-
- run: >-
316-
echo "- [Client Library](https://www.npmjs.com/package/@opentdf/sdk/v/${{ needs.deliver-ghp.outputs.FULL_VERSION }})">>$GITHUB_STEP_SUMMARY
317-
- run: >-
318-
echo "- [Command Line Tool](https://www.npmjs.com/package/@opentdf/ctl/v/${{ needs.deliver-ghp.outputs.FULL_VERSION }})">>$GITHUB_STEP_SUMMARY
319-
- run: >-
320-
echo "- [unpkg](https://unpkg.com/browse/@opentdf/sdk@${{ needs.deliver-ghp.outputs.FULL_VERSION }})">>$GITHUB_STEP_SUMMARY
321-
322231
ci:
323232
needs:
324233
- lib
@@ -329,5 +238,14 @@ jobs:
329238
runs-on: ubuntu-22.04
330239
if: ${{ !cancelled() }}
331240
steps:
332-
- if: contains(needs.*.result, 'failure')
333-
run: echo "Failed due to ${{ contains(needs.*.result, 'failure') }}" && exit 1
241+
242+
- name: "All jobs succeeded"
243+
id: success
244+
if: ${{ contains(needs.*.result, 'success') }}
245+
run: |
246+
:
247+
248+
- name: "One or more jobs failed"
249+
if: ${{ contains(needs.*.result, 'failure') }}
250+
run: |
251+
exit 1
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Create Release Branch"
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
# Default empty permissions for all jobs
8+
permissions: {}
9+
10+
jobs:
11+
create-release-branch:
12+
if: ${{ endsWith(github.event.release.tag_name, '.0') }}
13+
permissions:
14+
id-token: write
15+
uses: opentdf/platform/.github/workflows/reusable_create-release-branch.yaml@main
16+
secrets:
17+
APP_ID: ${{ secrets.APP_ID }}
18+
AUTOMATION_KEY: ${{ secrets.AUTOMATION_KEY }}

0 commit comments

Comments
 (0)