diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4754b74 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,55 @@ +name: Release + +on: + workflow_dispatch: + inputs: + bump: + description: 'Tipo de bump' + type: choice + required: true + default: minor + options: [patch, minor, major] + release-notes: + description: 'Release notes (markdown, opcional)' + type: string + required: false + +jobs: + release: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2.2' + bundler-cache: true + + - run: bundle exec rubocop + - run: bundle exec rspec + + - uses: fintoc-com/release-action/prepare@main + id: prep + with: + bump: ${{ inputs.bump }} + version-format: ruby + tag-prefix: v + app-id: ${{ vars.FIN_RELEASES_APP_ID }} + app-private-key: ${{ secrets.FIN_RELEASES_PRIVATE_KEY }} + + - name: Build and push gem + env: + GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} + run: | + gem build *.gemspec + gem push *.gem + + - uses: fintoc-com/release-action/finalize@main + with: + tag: ${{ steps.prep.outputs.tag }} + release-notes: ${{ inputs.release-notes }} + app-id: ${{ vars.FIN_RELEASES_APP_ID }} + app-private-key: ${{ secrets.FIN_RELEASES_PRIVATE_KEY }} diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..a639652 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,25 @@ +# Releasing + +Manual desde Actions. Toma ~3–4 min. + +## Cómo + +1. https://github.com/fintoc-com/fintoc-ruby/actions → **Release** → **Run workflow**. +2. `bump`: `patch` / `minor` / `major`. `release-notes`: markdown opcional. +3. **Run workflow**. Solo corre desde `main`. + +## Qué hace + +`bundle install` + `rubocop` + `rspec` → +[`release/prepare`](https://github.com/fintoc-com/release-action/tree/main/prepare) bumpea `lib/fintoc/version.rb` (y refresca `Gemfile.lock`) → +`gem build *.gemspec` + `gem push *.gem` (con `RUBYGEMS_API_KEY`) → +[`release/finalize`](https://github.com/fintoc-com/release-action/tree/main/finalize) pushea commit + tag, crea GitHub Release. + +Todo autoreado por `fin-releases[bot]`. + +## Si falla + +| Falla en | Estado | Recovery | +|---|---|---| +| Antes o durante `gem push` | Nada en el remote | Re-run | +| `release/finalize` (post-publish) | Gem en RubyGems, sin tag/release | PR con el commit del bump + `gh release create vX.Y.Z` |