-
Notifications
You must be signed in to change notification settings - Fork 7
Adjust release process to be based on package.json version #75
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0ab88c2
downgrade version
Ikuni17 a211e3d
package json version based release flow
Ikuni17 5df8176
rename file
Ikuni17 7989b4d
add setup node
Ikuni17 2e1ccd5
auto update dist in release prs
Ikuni17 c54a74e
Apply suggestions from code review
Ikuni17 41e87ac
Adjust exclude label
Ikuni17 61d0d9f
Merge branch 'master' into fix/release-process-changes
Ikuni17 96f8875
Merge branch 'master' into fix/release-process-changes
Ikuni17 9398022
Merge remote-tracking branch 'upstream/master' into fix/release-proce…
Ikuni17 284e307
fix version
Ikuni17 868dc33
claude review changes
Ikuni17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # yaml-language-server: $schema=https://json.schemastore.org/github-release-config.json | ||
| changelog: | ||
| exclude: | ||
| labels: | ||
| - skip-for-release-notes | ||
| categories: | ||
| - title: Breaking Changes | ||
| labels: | ||
| - breaking-change | ||
| - title: Enhancements | ||
| labels: | ||
| - enhancement | ||
| - title: Bug Fixes | ||
| labels: | ||
| - bug | ||
| - title: Dependencies | ||
| labels: | ||
| - dependencies | ||
| - title: Other Changes | ||
| labels: | ||
| - '*' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| name: Publish Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - 'package.json' | ||
|
|
||
| concurrency: | ||
| group: release | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| prepare: | ||
| if: github.event.repository.fork == false | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| should_release: ${{ steps.version.outputs.should_release }} | ||
| tag: ${{ steps.version.outputs.tag }} | ||
| version: ${{ steps.version.outputs.version }} | ||
| major_tag: ${{ steps.version.outputs.major_tag }} | ||
| previous_tag: ${{ steps.version.outputs.previous_tag }} | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: ${{ github.sha }} | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | ||
| with: | ||
| node-version: 24.14.0 | ||
|
|
||
| - name: Resolve release version | ||
| id: version | ||
| run: | | ||
| VERSION="$(node --print "require('./package.json').version")" | ||
|
|
||
| if ! printf '%s' "${VERSION}" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then | ||
| echo "package.json version must use x.y.z semver; received ${VERSION}." | ||
| exit 1 | ||
Ikuni17 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| fi | ||
|
|
||
| TAG="v${VERSION}" | ||
| MAJOR_TAG="${TAG%%.*}" | ||
| PREVIOUS_TAG="$(git describe --tags --abbrev=0 --match 'v[0-9]*.[0-9]*.[0-9]*')" | ||
|
|
||
| echo "version=${VERSION}" >> "${GITHUB_OUTPUT}" | ||
| echo "tag=${TAG}" >> "${GITHUB_OUTPUT}" | ||
| echo "major_tag=${MAJOR_TAG}" >> "${GITHUB_OUTPUT}" | ||
| echo "previous_tag=${PREVIOUS_TAG}" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| if git rev-parse "${TAG}" >/dev/null 2>&1; then | ||
| echo 'Release tag already exists. Skipping release.' | ||
| echo "should_release=false" >> "${GITHUB_OUTPUT}" | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ -z "${PREVIOUS_TAG}" ]; then | ||
| echo 'Expected an existing previous release tag.' | ||
| exit 1 | ||
| fi | ||
|
|
||
| PREVIOUS_VERSION="${PREVIOUS_TAG#v}" | ||
|
|
||
| if [ "$(printf '%s\n%s\n' "${PREVIOUS_VERSION}" "${VERSION}" | sort -V | sed -n '$p')" != "${VERSION}" ]; then | ||
| echo "package.json version ${VERSION} must be greater than the latest release tag ${PREVIOUS_TAG}." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "should_release=true" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| test: | ||
| if: ${{ needs.prepare.outputs.should_release == 'true' }} | ||
| needs: prepare | ||
| uses: ./.github/workflows/test.yml | ||
| with: | ||
| ref: ${{ github.sha }} | ||
| permissions: | ||
| contents: read | ||
|
|
||
| build: | ||
| if: ${{ needs.prepare.outputs.should_release == 'true' }} | ||
| needs: prepare | ||
| uses: ./.github/workflows/build.yml | ||
| with: | ||
| ref: ${{ github.sha }} | ||
| verify_dist: true | ||
| permissions: | ||
| contents: read | ||
|
|
||
| release: | ||
| if: ${{ needs.prepare.outputs.should_release == 'true' }} | ||
| needs: [prepare, test, build] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| env: | ||
| GIT_AUTHOR_NAME: github-actions[bot] | ||
| GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | ||
| GIT_COMMITTER_NAME: github-actions[bot] | ||
| GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: ${{ github.sha }} | ||
|
|
||
| - name: Create and push release tag | ||
| env: | ||
| TAG: ${{ needs.prepare.outputs.tag }} | ||
| run: | | ||
| git tag -a "${TAG}" -m "Release ${TAG}" "${GITHUB_SHA}" | ||
| git push origin "refs/tags/${TAG}" | ||
|
|
||
| - name: Create GitHub release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| PREVIOUS_TAG: ${{ needs.prepare.outputs.previous_tag }} | ||
| TAG: ${{ needs.prepare.outputs.tag }} | ||
| run: | | ||
| gh release create "${TAG}" --verify-tag --generate-notes --notes-start-tag "${PREVIOUS_TAG}" | ||
|
|
||
| - name: Update floating major tag | ||
| env: | ||
| MAJOR_TAG: ${{ needs.prepare.outputs.major_tag }} | ||
| RELEASE_SHA: ${{ github.sha }} | ||
| run: | | ||
| git tag -fa "${MAJOR_TAG}" -m "Release ${MAJOR_TAG}" "${RELEASE_SHA}" | ||
| git push origin "refs/tags/${MAJOR_TAG}" --force | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Changelog | ||
|
|
||
| Release notes are published on the GitHub releases page: | ||
|
|
||
| <https://github.com/elastic/github-actions/releases> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.