forked from arthurnn/memcached
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (48 loc) · 1.54 KB
/
build_release_pipeline.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Build and release ruby gem
on:
pull_request:
branches: [ 1-0-stable ]
push:
workflow_dispatch:
jobs:
build-release-pipeline:
runs-on: ubuntu-latest
steps:
- run: |
sudo apt-get update
sudo apt-get -y install memcached libsasl2-dev
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- run: bundle exec ruby test/setup.rb
- run: bundle exec rake
- name: Build
id: build
if: success()
run: |
bundle exec rake build
echo "::set-output name=gem_version::v$(bundle exec rake version)"
- name: Release
if: success() && github.ref == 'refs/heads/1-0-stable'
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 pkg/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/1-0-stable'
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
})