Debian Codegraph @

.github/workflows/ruby-release.yml

raw
1 #
2 # Copyright 2023 The Sigstore Authors.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 on:
17 push:
18 tags:
19 - 'release/ruby/v*'
20
21 permissions: {}
22
23 name: release Ruby Gem
24
25 jobs:
26 publish:
27 name: Publish to RubyGems
28 runs-on: ubuntu-latest
29 permissions:
30 contents: read
31 id-token: write # needed to authenticate to Google Cloud
32
33 defaults:
34 run:
35 working-directory: gen/pb-ruby
36
37 steps:
38 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
39 with:
40 persist-credentials: false
41
42 - uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299.0
43 with:
44 ruby-version: '3.3'
45
46 - name: Authenticate to Google Cloud
47 uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
48 with:
49 workload_identity_provider: projects/306323169285/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider
50 service_account: [email protected]
51
52 - uses: google-github-actions/get-secretmanager-secrets@bc9c54b29fdffb8a47776820a7d26e77b379d262 # v3.0.0
53 id: secrets
54 with:
55 secrets: |-
56 rubygems_auth_token:sigstore-secrets/protobuf-specs-rubygems-auth-token
57
58 - name: Build
59 run: |
60 gem build sigstore_protobuf_specs.gemspec
61
62 - name: Publish
63 run: |
64 mkdir -p $HOME/.gem
65 printf -- "---\n:rubygems_api_key: ${RUBYGEMS_AUTH_TOKEN}\n" > $HOME/.gem/credentials
66 chmod 0600 $HOME/.gem/credentials
67 gem push *.gem
68 env:
69 RUBYGEMS_AUTH_TOKEN: "${{ steps.secrets.outputs.rubygems_auth_token }}"