Skip to content

Commit 3db9b67

Browse files
authored
Feat: do99 - improvements for publish release flow (#411)
- Consolidated the release publish logic into only one file
1 parent 7f49822 commit 3db9b67

File tree

2 files changed

+30
-43
lines changed

2 files changed

+30
-43
lines changed
Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,38 @@
11
name: Publish Release
22

33
on:
4-
workflow_dispatch:
5-
release:
6-
types: [published]
4+
workflow_call: # is called from the create-release workflow
5+
workflow_dispatch: # manual trigger
6+
release: # triggered by release event
7+
types: [published, released, prereleased]
8+
# Notice:
9+
# ref: https://docs.github.com/en/webhooks/webhook-events-and-payloads#release
10+
# - "published" type is happening when the release is marked as "latest"
11+
# - "released" type is happening when a release was published, or a pre-release was changed to a release.
12+
# - "prereleased" type is happening when a release was created and identified as a pre-release. A pre-release is a release that is not ready for production and may be unstable.
713

8-
concurrency:
14+
concurrency: # With concurrency control: Only the latest workflow run executes, previous runs get cancelled
915
group: ${{ github.workflow }}-${{ github.ref }}
1016
cancel-in-progress: true
1117

1218
jobs:
13-
publish-types:
14-
name: Publish Typescript Types
15-
uses: burnt-labs/xion/.github/workflows/publish-types.yaml@workflows/main
16-
secrets: inherit
19+
trigger-types:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Trigger xion-types workflow
23+
uses: peter-evans/repository-dispatch@v2
24+
with:
25+
token: ${{ secrets.REPO_DISPATCH_TOKEN }}
26+
repository: burnt-labs/xion-types
27+
event-type: xion-types-release-trigger # NOTICE: must match the trigger in xion-types workflow
28+
# -client-payload logic description-
29+
# Checks if it's a pre-release: github.event.release.prerelease == true - if the release is marked as a pre-release, it sets release_type to 'prerelease'
30+
# If not a pre-release, checks for latest release: github.event.release.prerelease == false && github.event.release.draft == false && github.event.release.make_latest == 'true' - ensures it's not a pre-release, not a draft, and is marked as the latest release
31+
# Sets latest tag: If all the above conditions are true, it sets release_type to 'latest'
32+
# Fallback to published: If none of the above conditions are met, it sets release_type to 'published'
33+
client-payload: |
34+
{
35+
"release_type": "${{ github.event.release.prerelease == true && 'prerelease' || (github.event.release.prerelease == false && github.event.release.draft == false && github.event.release.make_latest == 'true' && 'latest' || 'published') }}",
36+
"tag_name": "${{ github.event.release.tag_name }}",
37+
"release_name": "${{ github.event.release.name }}"
38+
}

.github/workflows/publish-types.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)