-
Notifications
You must be signed in to change notification settings - Fork 164
Compute next version and add scheduled release #912
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 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0679fbd
Compute the next version from components
martincostello ad5b7f3
Create automated publishing schedule
martincostello fcd7610
Default to draft true
martincostello b3022e3
Simplify command
martincostello 2ba7198
Fix lint warning
martincostello c81c9b2
Resolve review comments
martincostello c7c7ff8
Add function for version diff
martincostello cd8afb8
Fix review comment
martincostello 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
Some comments aren't visible on the classic Files Changed page.
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
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,48 @@ | ||
| --- | ||
| name: Scheduled Release | ||
|
|
||
| on: | ||
| #schedule: | ||
| # - cron: '0 9 * * FRI' | ||
martincostello marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| workflow_dispatch: | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 10 | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
martincostello marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Get changes since last release | ||
| id: get-changes | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| LATEST="$(gh api "/repos/${GITHUB_REPOSITORY}/releases/latest" --jq .tag_name)" | ||
martincostello marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| CHANGED_FILES="$(git diff --name-only "${LATEST}" -- docker || true)" | ||
martincostello marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if [ -n "${CHANGED_FILES}" ]; then | ||
| echo "docker/ has changes since ${LATEST}" | ||
| echo "has-changes=true" >> "${GITHUB_OUTPUT}" | ||
| else | ||
| echo "docker/ has no changes since ${LATEST}" | ||
martincostello marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo "has-changes=false" >> "${GITHUB_OUTPUT}" | ||
| fi | ||
| - name: Publish release | ||
| if: steps.get-changes.outputs.has-changes == 'true' | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| echo '{"draft":true}' | gh workflow run publish-release.yml --json | ||
martincostello marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic is quite involved - would it make sense to extract it to a script that can be tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered adding it to a script, but then the only difference is that the repo now needs to be cloned to get it.
In terms of testability, you can just copy the script into a pwsh terminal and run it directly after setting a few env vars (which is how I tested it before opening the PR):
# <paste script excluding final two linesWhich outputs the following for different input combinations:
I'll refactor slightly so that the increment can be easily tested separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the latest refactor and we pretend that the last release was
0.11.10: