Remove astroapi.gemspec file, update Gemfile.lock to reflect gem name… #3
Workflow file for this run
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
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| test: | |
| name: Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3" | |
| bundler-cache: true | |
| - run: bundle exec rake | |
| publish: | |
| name: Publish to RubyGems | |
| needs: test | |
| runs-on: ubuntu-latest | |
| environment: rubygems | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3" | |
| bundler-cache: true | |
| - name: Verify tag matches gem version | |
| run: | | |
| GEM_VERSION=$(ruby -r ./lib/astroapi/version -e "puts Astroapi::VERSION") | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| if [ "$GEM_VERSION" != "$TAG_VERSION" ]; then | |
| echo "ERROR: Tag version ($TAG_VERSION) does not match gem version ($GEM_VERSION)" | |
| echo "Update lib/astroapi/version.rb before tagging." | |
| exit 1 | |
| fi | |
| - name: Publish to RubyGems (Trusted Publishing) | |
| uses: rubygems/release-gem@v1 | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release create "$GITHUB_REF_NAME" \ | |
| --title "$GITHUB_REF_NAME" \ | |
| --generate-notes \ | |
| astroapi-ruby-*.gem |