Fix #442914 bug #59
Workflow file for this run
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: Build and release ruby gem | |
on: | |
pull_request: | |
branches: [ v1.8.x ] | |
push: | |
workflow_dispatch: | |
jobs: | |
build-release-pipeline: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7.2 | |
rubygems: 3.1.4 | |
bundler-cache: true | |
- name: Build | |
id: build | |
if: success() | |
run: | | |
gem build memcached.gemspec | |
echo "::set-output name=gem_version::v$(bundle exec rake version)" | |
- name: Release | |
if: success() && github.ref == 'refs/heads/v1.8.x' | |
run: | | |
mkdir -p $HOME/.gem | |
touch $HOME/.gem/credentials | |
chmod 600 $HOME/.gem/credentials | |
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials | |
gem push vinted-memcached-*.gem -V | |
env: | |
GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_AUTH_TOKEN }}" | |
- name: Tag repo with new gem version | |
if: success() && github.ref == 'refs/heads/v1.8.x' | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
github.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/${{ steps.build.outputs.gem_version }}", | |
sha: context.sha | |
}) |