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.4.22 jobs: bump: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: recursive - uses: ruby/setup-ruby@master with: ruby-version: '3.1' bundler: ${{ env.BUNDLER_VER }} - if: ${{ github.event_name == 'workflow_dispatch' }} # unfortunatelly cannot keep this condition on job level run: | git config --global user.name github-actions git config --global 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: platform: [ linux-gnu, windows, darwin ] steps: - uses: actions/checkout@v4 with: submodules: recursive ref: main # https://github.com/actions/checkout/issues/439#issuecomment-830862188 - uses: ruby/setup-ruby@master with: ruby-version: '3.1' # 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 - name: Build gem and save version if: matrix.platform == 'linux-gnu' run: | gem build expressir.gemspec | grep -o 'Version: .*' | awk '{print $2}' > version - if: matrix.platform == 'linux-gnu' uses: actions/upload-artifact@v4 with: name: pkg-ruby path: expressir-*.gem - if: matrix.platform == 'linux-gnu' uses: actions/upload-artifact@v4 with: name: version path: version - 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.platform }} - uses: actions/upload-artifact@v4 with: name: pkg-${{ matrix.platform }} path: pkg/*.gem publish: runs-on: ubuntu-latest needs: pack steps: - uses: actions/download-artifact@v4 with: name: pkg-ruby path: pkg - uses: actions/download-artifact@v4 with: name: pkg-linux-gnu path: pkg - uses: actions/download-artifact@v4 with: name: pkg-windows path: pkg - uses: actions/download-artifact@v4 with: name: pkg-darwin path: pkg - uses: ruby/setup-ruby@master with: ruby-version: '3.1' - name: Publish to rubygems.org env: RUBYGEMS_API_KEY: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }} run: | ls -l pkg/ 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 sleep 5 verify: name: Verify published gem on ${{ matrix.os }} needs: publish runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ ubuntu-latest, windows-latest, macos-latest ] steps: - name: Install Ruby uses: ruby/setup-ruby@master with: ruby-version: 3.1 bundler-cache: true bundler: ${{ env.BUNDLER_VER }} - name: Download version uses: actions/download-artifact@v4 with: name: version - name: Install gem run: gem install expressir -v $(cat version) - name: Verify run: expressir version verify-alpine: name: Verify published gem on alpine needs: publish runs-on: ubuntu-latest container: image: alpine:3.17 steps: - name: Install packages run: apk --no-cache add bash build-base git ruby-dev gcc g++ automake - name: Download version uses: actions/download-artifact@v4 with: name: version - name: Install gem run: gem install expressir -v $(cat version) - name: Verify run: expressir version