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* ] jobs: bump: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 with: submodules: recursive - uses: ruby/setup-ruby@v1 with: ruby-version: '2.6' - 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-18.04 needs: bump strategy: fail-fast: false matrix: host: [ linux, windows, darwin ] steps: - uses: actions/checkout@v2 with: submodules: recursive - uses: ruby/setup-ruby@v1 with: ruby-version: '2.6' # 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 - 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@v2 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@v2 with: name: pkg-${{ matrix.host }} path: pkg/*.gem publish: runs-on: ubuntu-18.04 needs: pack steps: - uses: actions/download-artifact@v2 with: name: pkg-ruby path: pkg - uses: actions/download-artifact@v2 with: name: pkg-linux path: pkg - uses: actions/download-artifact@v2 with: name: pkg-windows path: pkg - uses: actions/download-artifact@v2 with: name: pkg-darwin path: pkg - uses: ruby/setup-ruby@v1 with: ruby-version: '2.6' - 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