Skip to content

Merge remote-tracking branch 'origin/expand-rails-version' into expan… #7

Merge remote-tracking branch 'origin/expand-rails-version' into expan…

Merge remote-tracking branch 'origin/expand-rails-version' into expan… #7

Workflow file for this run

name: Release and Publish

Check failure on line 1 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

(Line: 20, Col: 9): 'ref' is already defined
on:
release:
types: [published]
jobs:
update-changelog-and-publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: main
fetch-depth: 0
ref: main
- 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
run: |
gem push structured_params-*.gem