Skip to content

v0.5.0

v0.5.0 #11

Workflow file for this run

name: Release and Publish
on:
release:
types: [ published ]
workflow_run:
workflows: ["Update Version"]
types: [completed]
branches: [main]
jobs:
update-changelog-and-publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
# Only run if the workflow_run was successful or if triggered by release event
if: |
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') ||
(github.event_name == 'release')
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: main
fetch-depth: 0
- name: Configure Git
uses: ./.github/actions/configure-git
- name: Extract version from release
id: extract_version
run: |
TAG_NAME=${{ github.event.release.tag_name }}
VERSION=${TAG_NAME#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
- name: Update CHANGELOG
run: |
VERSION="${{ steps.extract_version.outputs.version }}"
CURRENT_DATE=$(date +%Y-%m-%d)
RELEASE_NOTES="${{ github.event.release.body }}"
# Create temporary changelog entry
echo "## [$VERSION] - $CURRENT_DATE" > temp_changelog.md
echo "" >> temp_changelog.md
# Add release notes from GitHub release
if [ -n "$RELEASE_NOTES" ]; then
echo "$RELEASE_NOTES" >> temp_changelog.md
else
echo "- Release ${{ steps.extract_version.outputs.tag_name }}" >> temp_changelog.md
fi
echo "" >> temp_changelog.md
# Prepend to existing CHANGELOG (skip the header)
if [ -f CHANGELOG.md ]; then
tail -n +3 CHANGELOG.md >> temp_changelog.md
fi
# Add header back
echo "# Changelog" > CHANGELOG.md
echo "" >> CHANGELOG.md
cat temp_changelog.md >> CHANGELOG.md
# Clean up temporary file
rm -f temp_changelog.md
- name: Commit CHANGELOG update
run: |
git add CHANGELOG.md
if git diff --staged --quiet; then
echo "No CHANGELOG changes to commit"
else
git commit -m "Update CHANGELOG for ${{ steps.extract_version.outputs.tag_name }}"
git push origin main
fi
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true
- name: Build gem
run: |
gem build structured_params.gemspec
- name: Publish to RubyGems
uses: rubygems/release-gem@v1