This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
chore: allow up-to-date pagy versions #187
This file contains 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: | |
branches: [ main ] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The release version' | |
required: true | |
jobs: | |
prepare-release: | |
runs-on: ubuntu-latest | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
version: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Generate Release ποΈ | |
uses: GoogleCloudPlatform/release-please-action@v3 | |
id: release | |
with: | |
release-type: ruby | |
package-name: rails-mini-profiler | |
bump-minor-pre-major: true | |
version-file: 'dummy.rb' # Don't set the version file, we do version increments ourselves on release | |
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{"type":"refactor","section":"Miscellaneous","hidden":false}]' | |
release: | |
needs: prepare-release | |
runs-on: ubuntu-latest | |
if: needs.prepare-release.outputs.release_created || github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
env: | |
BUNDLE_WITHOUT: 'development' | |
- name: Release Version | |
id: release-version | |
run: | | |
if [[ ${{github.event_name}} == 'workflow_dispatch' ]]; then | |
version=${{ github.event.inputs.version }} | |
else | |
version=${{ needs.prepare-release.outputs.version }} | |
fi | |
echo "::set-output name=version::$version" | |
- name: Read Node Version | |
id: node-version | |
run: | | |
version=$(cat .tool-versions| grep nodejs | cut -d' ' -f2) | |
echo "::set-output name=version::$version" | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '${{ steps.node-version.outputs.version }}' | |
cache: 'npm' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install Packages | |
uses: bahmutov/npm-install@v1 | |
- name: Compile Assets | |
run: npm run build | |
- name: Bump Gem Version | |
run: | | |
sed -i "s|\(VERSION = \)'.*'|\1'${{ steps.release-version.outputs.version }}'|" lib/rails_mini_profiler/version.rb | |
- name: Update Gemfile.lock | |
run: | | |
bundle config unset deployment | |
bundle install --jobs 4 | |
- name: Bump Package Version | |
id: bump-version | |
run: | | |
npm version --no-git-tag-version ${{ steps.release-version.outputs.version }} | |
- name: Publish Gem π | |
run: | | |
mkdir -p $HOME/.gem | |
touch $HOME/.gem/credentials | |
chmod 0600 $HOME/.gem/credentials | |
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials | |
gem build *.gemspec | |
gem push *.gem | |
env: | |
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}} | |
- name: Publish Package π¦ | |
run: | | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }} | |
- name: Commit Updated Files π€ | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: "['Gemfile.lock', 'package.json', 'package-lock.json', 'lib/rails_mini_profiler/version.rb']" | |
message: "chore: post-release ${{ steps.release-version.outputs.version }}" |