name: release on: workflow_dispatch: inputs: next_version: description: | Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc required: true default: 'patch' push: tags: [ v* ] concurrency: group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}' cancel-in-progress: true env: BUNDLER_VER: 2.3.24 # Forcing bundler version to ensure that it is consistent everywhere and # does not cause bundler gem reinstalls # bundler/rubygems 2.3.22 is a minimal requirement to support gnu/musl differentiation # https://github.com/rubygems/rubygems/pull/4488 jobs: bump: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: submodules: recursive - uses: ruby/setup-ruby@master with: ruby-version: '3.0' bundler: ${{ env.BUNDLER_VER }} - if: ${{ github.event_name == 'workflow_dispatch' }} # unfortunatelly cannot keep this condition on job level run: | git config user.name github-actions git config user.email github-actions@github.com gem install gem-release gem bump --version ${{ github.event.inputs.next_version }} --tag --push pack: runs-on: ubuntu-latest needs: bump strategy: fail-fast: false matrix: host: [ linux, windows, darwin ] steps: - uses: actions/checkout@v2 with: submodules: recursive ref: main # https://github.com/actions/checkout/issues/439#issuecomment-830862188 - uses: ruby/setup-ruby@master with: ruby-version: '3.0' # bundler-cache: true important to not use cache because it leads to "cannot find -lrice" # more info https://github.com/lutaml/expressir/runs/2097658383?check_suite_focus=true#step:7:2126 bundler: ${{ env.BUNDLER_VER }} - run: bundle install --jobs 4 --retry 3 # build gem WITHOUT pre-built native extension - run: gem build expressir.gemspec - if: matrix.host == 'linux' uses: actions/upload-artifact@v3 with: name: pkg-ruby path: expressir-*.gem - name: Enable swap run: | sudo fallocate -l 15g /compile.swap sudo chmod 600 /compile.swap sudo mkswap /compile.swap sudo swapon /compile.swap sudo swapon --all --verbose # build gem WITH pre-built native extension - run: bundle exec rake gem:${{ matrix.host }} - uses: actions/upload-artifact@v3 with: name: pkg-${{ matrix.host }} path: pkg/*.gem publish: runs-on: ubuntu-18.04 needs: pack steps: - uses: actions/download-artifact@v3 with: name: pkg-ruby path: pkg - uses: actions/download-artifact@v3 with: name: pkg-linux path: pkg - uses: actions/download-artifact@v3 with: name: pkg-windows path: pkg - uses: actions/download-artifact@v3 with: name: pkg-darwin path: pkg - uses: ruby/setup-ruby@master with: ruby-version: '3.0' bundler: ${{ env.BUNDLER_VER }} - run: ls -l pkg/ - name: Publish to rubygems.org env: RUBYGEMS_API_KEY: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }} run: | mkdir -p ~/.gem cat > ~/.gem/credentials << EOF --- :rubygems_api_key: ${RUBYGEMS_API_KEY} EOF chmod 0600 ~/.gem/credentials gem signin for gem in pkg/*.gem; do gem push $gem -V; done