-
Notifications
You must be signed in to change notification settings - Fork 2
Add release workflow for crates.io publishing #21
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,75 @@ | ||||||
| name: Publish to crates.io | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| tags: ['v*'] | ||||||
|
|
||||||
| jobs: | ||||||
| test: | ||||||
| runs-on: ubuntu-24.04 | ||||||
|
|
||||||
| steps: | ||||||
| - name: Print environment (debug) | ||||||
| run: env | ||||||
|
|
||||||
| - name: Fetch sources | ||||||
| uses: actions/checkout@v4 | ||||||
| with: | ||||||
| submodules: recursive | ||||||
|
|
||||||
| - name: Run tests | ||||||
| uses: frequenz-floss/gh-action-cargo-test@v1.0.0 | ||||||
|
|
||||||
| create-github-release: | ||||||
| needs: ["test"] | ||||||
| name: Create GitHub release | ||||||
| runs-on: ubuntu-24.04 | ||||||
| permissions: | ||||||
| # We need write permissions on contents to create GitHub releases and on | ||||||
| # discussions to create the release announcement in the discussion forums | ||||||
| contents: write | ||||||
| discussions: write | ||||||
| steps: | ||||||
| - name: Download RELEASE_NOTES.md | ||||||
| run: | | ||||||
| set -ux | ||||||
| gh api \ | ||||||
| -X GET \ | ||||||
| -f ref=$REF \ | ||||||
| -H "Accept: application/vnd.github.raw" \ | ||||||
| "/repos/$REPOSITORY/contents/RELEASE_NOTES.md" \ | ||||||
| > RELEASE_NOTES.md | ||||||
| env: | ||||||
| REF: ${{ github.ref }} | ||||||
| REPOSITORY: ${{ github.repository }} | ||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
|
|
||||||
| - name: Create GitHub release | ||||||
| run: | | ||||||
| set -ux | ||||||
| extra_opts= | ||||||
| if echo "$REF_NAME" | grep -- -; then extra_opts=" --prerelease"; fi | ||||||
|
||||||
| if echo "$REF_NAME" | grep -- -; then extra_opts=" --prerelease"; fi | |
| if echo "$REF_NAME" | grep -E -- '-(alpha|beta|rc)'; then extra_opts=" --prerelease"; fi |
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 is copied from repo-config, I'm sure it is fine.
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.
Inconsistent checkout action versions used across the workflow. The test job uses @v4 while the publish job uses @v5. Consider standardizing on @v5 throughout for consistency.
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.
Would rather wait for dependabot to fix.