Skip to content

Commit

Permalink
chore: Update release process to use the common Ruby release scripts (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dazuma authored Sep 14, 2021
1 parent 7909c60 commit 48b657f
Show file tree
Hide file tree
Showing 13 changed files with 142 additions and 124 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/release-core.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/release-generator.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/release-please-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: release-please-label
on:
pull_request_target:
branches:
- master
types:
- opened
jobs:
release-please-label:
if: "${{ github.event.sender.login == 'yoshi-code-bot' && startsWith(github.event.pull_request.title, 'chore: release ') }}"
runs-on: ubuntu-latest
steps:
- name: ReleaseLabel
uses: actions/github-script@v4
with:
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
script: |
core.info('Labeling release');
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: ['autorelease: pending']
});
core.info('Labeled');
38 changes: 38 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release-Please
on:
schedule:
- cron: '37 8 * * *'
workflow_dispatch:
inputs:
gem:
description: "Name of single gem to release. Leave blank to check all gems."
required: false
args:
description: "Extra command line arguments."
required: false

jobs:
release-please:
if: ${{ github.repository == 'googleapis/google-api-ruby-client' }}
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
RELEASE_PLEASE_DISABLE: ${{ secrets.RELEASE_PLEASE_DISABLE }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
- name: Install NodeJS 12.x
uses: actions/setup-node@v2
with:
node-version: "12.x"
- name: Install tools
run: "gem install --no-document toys && npm install release-please"
- name: execute
run: |
toys release please -v --fork \
--github-event-name=${{ github.event_name }} \
${{ github.event.inputs.args }} -- ${{ github.event.inputs.gem }}
40 changes: 0 additions & 40 deletions .github/workflows/release-umbrella.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ atlassian*

__pycache__/
/vendor/

/node-modules/
/package-lock.json
28 changes: 28 additions & 0 deletions .kokoro/common.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Build logs will be here
action {
define_artifacts {
regex: "**/*sponge_log.xml"
}
}

# Download resources for system tests (service account key, etc.)
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-ruby"

# Download trampoline resources.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Use the trampoline script to run in docker.
build_file: "google-api-ruby-client/.kokoro/trampoline_v2.sh"

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/release"
}

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,docuploader_service_account"
}
6 changes: 6 additions & 0 deletions .kokoro/release-generated.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: ".kokoro/release-generated.sh"
}
15 changes: 15 additions & 0 deletions .kokoro/release-generated.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -eo pipefail

# Install gems in the user directory because the default install directory
# is in a read-only location.
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH

python3 -m pip install git+https://github.com/googleapis/releasetool
python3 -m pip install gcp-docuploader
gem install --no-document toys

# This is not called from autorelease, so don't run publish-reporter-script
toys release perform -v --base_dir=generated --all=google-apis- --enable-docs --enable-rad < /dev/null
6 changes: 6 additions & 0 deletions .kokoro/release.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: ".kokoro/release.sh"
}
5 changes: 2 additions & 3 deletions .kokoro/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ export PATH=$GEM_HOME/bin:$PATH
python3 -m pip install git+https://github.com/googleapis/releasetool
python3 -m pip install gcp-docuploader
gem install --no-document toys
bundle install

if [ "$PACKAGE" = "ALL_GENERATED" ]; then
# This is not called from autorelease, so don't run publish-reporter-script
# TODO(dazuma): Remove this clause once we switch to release-generated
toys kokoro release-all-generated < /dev/null
else
python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script
toys kokoro release "$PACKAGE" < /dev/null
toys release perform -v --enable-docs --enable-rad < /dev/null
fi
18 changes: 18 additions & 0 deletions .toys/release.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load_git remote: "https://github.com/googleapis/ruby-common-tools.git",
path: "toys/release"
2 changes: 1 addition & 1 deletion .trampolinerc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ required_envvars+=(

# Add env vars which are passed down into the container here.
pass_down_envvars+=(
"AUTORELEASE_PR" "RELEASE_DRY_RUN" "PACKAGE"
"AUTORELEASE_PR" "RELEASE_DRY_RUN" "PACKAGE" "RELEASE_PACKAGE" "KOKORO_GIT_COMMIT" "RUBY_VERSIONS" "EXTRA_CI_ARGS"
)

# Prevent unintentional override on the default image.
Expand Down

0 comments on commit 48b657f

Please sign in to comment.