-
Notifications
You must be signed in to change notification settings - Fork 112
Add an automated, monthly release workflow. #233
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
fruffy
merged 3 commits into
p4lang:main
from
Anamika1608:automated-monthly-releases-final
Mar 20, 2026
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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,28 @@ | ||
| # .github/release.yml | ||
|
|
||
| changelog: | ||
| exclude: | ||
| labels: | ||
| - ignore-for-release | ||
| categories: | ||
| - title: Breaking Changes | ||
| labels: | ||
| - breaking-change | ||
| - title: Bug Fixes | ||
| labels: | ||
| - bug | ||
| - title: Enhancements | ||
| labels: | ||
| - enhancement | ||
| - title: Python Changes | ||
| labels: | ||
| - python | ||
| - title: Dependencies | ||
| labels: | ||
| - dependencies | ||
| - title: CI/Infrastructure | ||
| labels: | ||
| - github_actions | ||
| - 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| name: Automated Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: "17 12 1 * *" # At 12:17 on day-of-month 1 (avoid top-of-hour load) | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| # Check if the event is not triggered by a fork | ||
| if: ${{ github.repository == 'p4lang/ptf' && github.ref == 'refs/heads/main' }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| # Fetch all history for all branches and tags | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Increment version number | ||
| run: perl -i -pe 's/\b(\d+)(?=\D*$)/$1+1/e' Version.txt | ||
|
|
||
| - name: Get changelog | ||
| id: changelog | ||
| run: | | ||
| TAG="$(git describe --tags --abbrev=0 2>/dev/null || git rev-list --max-parents=0 HEAD)" | ||
| GIT_LOG="$(git log $TAG..HEAD --oneline --pretty=format:"- %s [%an]")" | ||
| CHANGELOG=$(cat << EOF | ||
| Changelog: | ||
| $GIT_LOG | ||
| EOF | ||
| ) | ||
| CHANGELOG="${CHANGELOG//'#'/''}" | ||
| echo "content<<EOF" >> "$GITHUB_OUTPUT" | ||
| echo "$CHANGELOG" >> "$GITHUB_OUTPUT" | ||
| echo "EOF" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Display changelog | ||
| run: | | ||
| cat <<'EOF' | ||
| ${{ steps.changelog.outputs.content }} | ||
| EOF | ||
|
|
||
| - name: Get version | ||
| run: | | ||
| VERSION="$(cat Version.txt)" | ||
| echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
|
|
||
| - name: Get commit message | ||
| id: message | ||
| run: | | ||
| COMMIT_MSG=$(cat << 'EOF' | ||
| Release v${{ env.VERSION }} | ||
|
|
||
| ${{ steps.changelog.outputs.content }} | ||
| EOF | ||
| ) | ||
| echo "content<<EOF" >> "$GITHUB_OUTPUT" | ||
| echo "$COMMIT_MSG" >> "$GITHUB_OUTPUT" | ||
| echo "EOF" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Get pull request body message | ||
| id: body | ||
| run: | | ||
| MSG=$(cat << 'EOF' | ||
| Auto-generated pull request for version ${{ env.VERSION }}. | ||
|
|
||
| Please use **Squash and merge** to include the changelog in the release message. | ||
|
|
||
| ${{ steps.changelog.outputs.content }} | ||
| EOF | ||
| ) | ||
| echo "content<<EOF" >> "$GITHUB_OUTPUT" | ||
| echo "$MSG" >> "$GITHUB_OUTPUT" | ||
| echo "EOF" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@v8 | ||
| with: | ||
| base: main | ||
| add-paths: Version.txt | ||
| reviewers: fruffy, jafingerhut, jnfoster | ||
| commit-message: ${{ steps.message.outputs.content }} | ||
| signoff: false | ||
| branch: v${{ env.VERSION }} | ||
| delete-branch: true | ||
| title: Automated Release v${{ env.VERSION }} | ||
| body: ${{ steps.body.outputs.content }} | ||
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,54 @@ | ||
| name: GitHub Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "Version.txt" | ||
| - ".github/workflows/ci-release.yml" | ||
|
|
||
| # Cancel any preceding run on the pull request. | ||
| concurrency: | ||
| group: release-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| jobs: | ||
| build: | ||
| if: ${{ github.repository == 'p4lang/ptf' }} | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Get version | ||
| run: | | ||
| VERSION="$(cat Version.txt)" | ||
| TAG="v$(cat Version.txt)" | ||
| echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
| echo "TAG=$TAG" >> $GITHUB_ENV | ||
|
|
||
| - name: Check if tag exists | ||
| id: check_tag | ||
| run: | | ||
| TAG="${{ env.TAG }}" | ||
| if git rev-parse "$TAG" >/dev/null 2>&1; then | ||
| echo "Tag $TAG already exists, skipping release creation." | ||
| echo "tag_exists=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "Tag $TAG does not exist." | ||
| echo "tag_exists=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Release | ||
| if: steps.check_tag.outputs.tag_exists == 'false' | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ env.TAG }} | ||
| generate_release_notes: true | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 @@ | ||
| 0.11.0 |
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.