Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add publish workflow with workflow_dispatch #824

Merged
merged 9 commits into from
Dec 7, 2023
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
44 changes: 44 additions & 0 deletions .github/actions/get-release-notes/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Return the release notes extracted from the PR body

#
# Returns the release notes from the content of a pull request linked to a release branch. It expects the branch name to be in the format release/vX.Y.Z, release/X.Y.Z, release/vX.Y.Z-beta.N. etc.
#
# TODO: Remove once the common repo is public.
#
inputs:
version :
required: true
repo_name:
required: false
repo_owner:
required: true
token:
required: true

runs:
using: composite

steps:
- id: get_release_notes
shell: bash
run: |
RELEASE_PR_BRANCH="release/$VERSION"
API_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/pulls"
RELEASE_NOTES=$(curl -G \
-H "Accept: application/json" \
-H "Authorization: token $GITHUB_TOKEN" \
--data-urlencode "state=all" \
--data-urlencode "head=$REPO_OWNER:$RELEASE_PR_BRANCH" \
"$API_URL" | jq -r ".[0].body"
)
{
echo 'RELEASE_NOTES<<EOF'
echo $RELEASE_NOTES
echo 'EOF'
} >> $GITHUB_ENV

env:
GITHUB_TOKEN: ${{ inputs.token }}
REPO_OWNER: ${{ inputs.repo_owner }}
REPO_NAME: ${{ inputs.repo_name }}
VERSION: ${{ inputs.version }}
4 changes: 2 additions & 2 deletions .github/actions/get-version/action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Return the version extracted from the branch name

#
# Returns the version from a branch name of a pull request. It expects the branch name to be in the format release/vX.Y.Z, release/X.Y.Z, release/vX.Y.Z-beta.N. etc.
# Returns the version from the .version file.
#
# TODO: Remove once the common repo is public.
#
Expand All @@ -17,7 +17,7 @@ runs:
- id: get_version
shell: bash
run: |
VERSION=$(echo ${BRANCH_NAME} | sed -r 's#release/+##g')
VERSION=$(head -1 .version)
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
13 changes: 12 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
types:
- closed
workflow_dispatch:

permissions:
contents: write
Expand Down Expand Up @@ -36,6 +37,16 @@ jobs:
with:
version: ${{ steps.get_version.outputs.version }}

# Get the release notes
# This will expose the release notes as env.RELEASE_NOTES
- id: get_release_notes
uses: ./.github/actions/get-release-notes
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ steps.get_version.outputs.version }}
repo_owner: ${{ github.repository_owner }}
repo_name: ${{ github.event.repository.name }}

# Check if the tag already exists
- id: tag_exists
uses: ./.github/actions/tag-exists
Expand Down Expand Up @@ -64,7 +75,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.get_version.outputs.version }}
body: ${{ github.event.pull_request.body }}
body: ${{ env.RELEASE_NOTES }}
tag: ${{ steps.get_version.outputs.version }}
commit: ${{ github.sha }}
prerelease: ${{ steps.get_prerelease.outputs.prerelease }}
3 changes: 2 additions & 1 deletion .shiprc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"files": {
"src/networking/telemetry.ts": []
"src/networking/telemetry.ts": [],
".version": []
},
"postbump": "node scripts/jsdocs.js"
}
1 change: 1 addition & 0 deletions .version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v3.1.0