name: Release on: push: tags: - "v*" jobs: build: name: Build runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: bundler-cache: true - run: bundle exec rake release: needs: build name: Release runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Generate Changelog run: | # Get version from github ref (remove 'refs/tags/' and prefix 'v') version="${GITHUB_REF#refs/tags/v}" npx changelog-parser CHANGELOG.md | jq -cr ".versions | .[] | select(.version == \"$version\") | .body" > ${{ github.workflow }}-CHANGELOG.txt - name: Release uses: softprops/action-gh-release@v1 with: body_path: ${{ github.workflow }}-CHANGELOG.txt env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} publish: needs: [build, release] name: Publish runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 - name: Publish to RubyGems run: | mkdir -p $HOME/.gem touch $HOME/.gem/credentials chmod 0600 $HOME/.gem/credentials printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials gem build *.gemspec gem push *.gem env: GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"