Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release steps to the buildkite pipeline #544

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .buildkite/pipeline.release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
agents:
queue: hosted

steps:
- command: "auto/release-gem"
label: ":rubygems:"
key: release
env:
RELEASE_VERSION: "__TEMPLATE__"
plugins:
- rubygems-oidc#bashify:
role: "rg_oidc_akr_xoy8sqmj25t8ok4rn5sq"
- docker#v5.12.0:
image: "ruby:3.4-slim"
environment:
- GEM_HOST_API_KEY
- RELEASE_VERSION
35 changes: 33 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,32 @@ agents:
steps:
- command: "auto/run-sorbet"
label: ":sorbet:"
key: sorbet
env:
DOCKER_IMAGE: "ruby"
RUBY_VERSION: "3.1"

- command: "auto/run-require-strict-typing"
label: "typed: strict"
key: strict-typing
env:
DOCKER_IMAGE: "ruby"
RUBY_VERSION: "3.1"

- command: "auto/run-quality"
label: "quality"
key: quality
env:
DOCKER_IMAGE: "ruby"
RUBY_VERSION: "3.1"

- wait

- command: "auto/run-specs"
label: "rspec ({{matrix}})"
key: specs-legacy
depends_on:
- quality
- sorbet
- strict-typing
env:
DOCKER_IMAGE: "ruby"
RUBY_VERSION: "{{matrix}}"
Expand All @@ -39,6 +45,11 @@ steps:

- command: "auto/run-specs"
label: "rspec ({{matrix}})"
key: specs
depends_on:
- quality
- sorbet
- strict-typing
env:
DOCKER_IMAGE: "ruby"
RUBY_VERSION: "{{matrix}}"
Expand All @@ -51,6 +62,11 @@ steps:

- command: "auto/run-specs"
label: "rspec (jruby-{{matrix}})"
key: specs-jruby
depends_on:
- quality
- sorbet
- strict-typing
env:
DOCKER_IMAGE: "jruby"
RUBY_VERSION: "{{matrix}}"
Expand All @@ -62,9 +78,24 @@ steps:

- command: "auto/run-specs"
label: "rspec (jruby-{{matrix}})"
key: specs-jruby-soft
depends_on:
- quality
- sorbet
- strict-typing
env:
DOCKER_IMAGE: "jruby"
RUBY_VERSION: "{{matrix}}"
soft_fail: true
matrix:
- "9.4"

- command: "auto/upload-release-steps"
label: "release?"
key: upload-release
depends_on:
- specs
- specs-legacy
- specs-jruby
- specs-jruby-soft
#branch: main
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uncomment this before merging

21 changes: 21 additions & 0 deletions auto/release-gem
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -euo pipefail

if [ -z "${GEM_HOST_API_KEY}" ]; then
echo "GEM_HOST_API_KEY environment variable not found"
exit
fi

echo "--- Build and publish gem"

cd $(dirname $0)/..

# apt-get update --assume-yes && apt-get install --assume-yes ruby-rubygems
# gem build pdf-reader.gemspec
# GEM_HOST_API_KEY="${GEM_HOST_API_KEY}" gem push "pdf-reader-${RELEASE_VERSION}.gem"

#docker run -it -v "${PWD}:/work" -w /work -e GEM_HOST_API_KEY="${GEM_HOST_API_KEY}" ruby:3.4-slim bash -c "gem build pdf-reader.gemspec && gem push \"pdf-reader-${RELEASE_VERSION}.gem\""

gem build pdf-reader.gemspec
gem push "pdf-reader-${RELEASE_VERSION}.gem"
23 changes: 23 additions & 0 deletions auto/upload-release-steps
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -euo pipefail

#if [ "${BUILDKITE_BRANCH}" != "main" ]; then
# echo "Non main branch, skipping release"
# exit
#fi

GEMSPEC_PATH="$(dirname $0)/../pdf-reader.gemspec"

RELEASE_VERSION=$(grep "spec.version =" $GEMSPEC_PATH | sed -r 's/.*spec.version = "([^"]+)".*/\1/')

echo "version: ${RELEASE_VERSION}"

if [ $(curl -s -o /dev/null -w "%{http_code}" https://rubygems.org/api/v2/rubygems/pdf-reader/versions/${RELEASE_VERSION}.json) == "200" ]; then
echo "Gem version ${RELEASE_VERSION} already found on rubygems, skipping release"
exit
fi

export RELEASE_VERSION

cat $(dirname $0)/../.buildkite/pipeline.release.yml | sed -r 's/__TEMPLATE__/${RELEASE_VERSION}/' | buildkite-agent pipeline upload
2 changes: 1 addition & 1 deletion pdf-reader.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# which will make the gem filesize irritatingly large
Gem::Specification.new do |spec|
spec.name = "pdf-reader"
spec.version = "2.13.0"
spec.version = "2.14.0"
spec.summary = "A library for accessing the content of PDF files"
spec.description = "The PDF::Reader library implements a PDF parser conforming as much as possible to the PDF specification from Adobe"
spec.license = "MIT"
Expand Down