Skip to content

Commit a3ebfeb

Browse files
authored
feat(release): Adds release-please for release management (#9)
1 parent be93723 commit a3ebfeb

21 files changed

+738
-145
lines changed

.github/workflows/container.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: Publish OCI Container
3+
on: # yamllint disable-line rule:truthy
4+
workflow_call:
5+
inputs:
6+
tag:
7+
description: 'The tag to use for the container image'
8+
required: false
9+
type: string
10+
workflow_dispatch:
11+
inputs:
12+
tag:
13+
description: 'The tag to use for the container image'
14+
required: false
15+
type: string
16+
jobs:
17+
publish_github:
18+
name: Publish the container image to GitHub Container Registry
19+
runs-on: ubuntu-latest
20+
strategy:
21+
# Go hard on the builders
22+
max-parallel: 5
23+
matrix:
24+
alpine-version: ['3.21']
25+
ruby-version: ['3.4.7']
26+
steps:
27+
-
28+
name: Checkout repository
29+
uses: actions/checkout@v4
30+
-
31+
name: Publish to ghcr.io
32+
env:
33+
ALPINE_VERSION: ${{ matrix.alpine-version }}
34+
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
RUBY_VERSION: ${{ matrix.ruby-version }}
36+
TAG: ${{ github.event.inputs.tag || '' }}
37+
TRACE: ${{ secrets.ACTIONS_STEP_DEBUG || 'false' }}
38+
# yamllint disable rule:line-length
39+
run: |
40+
if [ -z "$TAG" ]
41+
then
42+
[ "$TRACE" = true ] && printf 'No tag provided, getting tag from .version.txt\n' >&2
43+
if [ -f ".version.txt" ]
44+
then
45+
version=$(<.version.txt)
46+
else
47+
[ "$TRACE" = true ] && printf 'No .version.txt found, getting version from git describe --tags --abbrev=0\n' >&2
48+
version=$(git describe --tags --abbrev=0)
49+
fi
50+
else
51+
[ "$TRACE" = true ] && printf 'Using provided tag %s\n' "$TAG" >&2
52+
version=$TAG
53+
fi
54+
[ "$TRACE" = 'true' ] && printf 'Calling ./ci/build_image.sh -vvp "%s"\n' "$version" >&2
55+
IMAGE_NAME=$(basename "$GITHUB_REPOSITORY") \
56+
GITHUB_TOKEN=$REGISTRY_TOKEN \
57+
ALPINE_VERSION=$ALPINE_VERSION \
58+
RUBY_VERSION=$RUBY_VERSION \
59+
./ci/build_image.sh -vvp "$version"
60+
# yamllint enable rule:line-length
61+
shell: bash
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: Conventional Commits And PR titles
3+
4+
on: # yamllint disable-line rule:truthy
5+
pull_request_target:
6+
types:
7+
- opened
8+
- edited
9+
- synchronize
10+
11+
jobs:
12+
comventional_commits:
13+
name: Validate Commit Subjects
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: webiny/action-conventional-commits@v1.3.0
18+
name: Validate Commit Subjects
19+
with:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
# All of the Angular commit types are allowed by default.
22+
# Added types to this:
23+
# * eyes - For observability related changes
24+
# * sec - For security related changes
25+
allowed-commit-types: "build,chore,ci,doc,documentation,docs,eyes,feat,fix,perf,refactor,revert,sec,style,test" # yamllint disable-line rule:line-length
26+
conventional_pr_title:
27+
name: Validate PR title
28+
runs-on: ubuntu-latest
29+
steps:
30+
-
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
id: validate-pr-title
34+
name: Validate PR title
35+
uses: amannn/action-semantic-pull-request@v5
36+
with:
37+
# All of the Angular commit types are allowed by default.
38+
# Added types to this:
39+
# * eyes - For observability related changes
40+
# * sec - For security related changes
41+
types: |
42+
build
43+
chore
44+
ci
45+
doc
46+
documentation
47+
docs
48+
eyes
49+
feat
50+
fix
51+
perf
52+
refactor
53+
revert
54+
sec
55+
style
56+
test
57+
# We don't enforce scopes
58+
# scopes:
59+
# - frontend
60+
# - backend
61+
# - ci
62+
# We don't disallow any scopes
63+
# disallowScopes: |
64+
# release
65+
wip: true

.github/workflows/gem.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Publish Ruby Gem
3+
on: # yamllint disable-line rule:truthy
4+
workflow_call:
5+
workflow_dispatch:
6+
jobs:
7+
publish_gem:
8+
name: Publish the gem to registries
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
registry:
13+
- key: rubygems
14+
secret: RUBYGEMS_TOKEN
15+
steps:
16+
-
17+
name: Checkout repository
18+
uses: actions/checkout@v4
19+
-
20+
name: Set up Ruby
21+
uses: ruby/setup-ruby@v1
22+
with:
23+
ruby-version: 3.4.1
24+
bundler-cache: false
25+
-
26+
name: Publish to ${{ matrix.registry }}
27+
env:
28+
TRACE: ${{ secrets.ACTIONS_STEP_DEBUG || 'false' }}
29+
GEM_TOKEN: ${{ secrets[matrix.registry.secret] }}
30+
REGISTRY: ${{ matrix.registry.key }}
31+
run: |
32+
bundle install
33+
TRACE="$TRACE" GEM_TOKEN="$GEM_TOKEN" ./ci/publish-gem.sh "$REGISTRY"
34+
shell: bash

.github/workflows/main.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Ruby
2+
3+
on:
4+
workflow_call:
5+
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
name: Ruby ${{ matrix.ruby }}
12+
strategy:
13+
matrix:
14+
ruby:
15+
- '3.4.7'
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Ruby
19+
uses: ruby/setup-ruby@v1
20+
with:
21+
ruby-version: ${{ matrix.ruby }}
22+
bundler-cache: false
23+
- name: Install dependencies
24+
run: bundle install --jobs 4 --retry 3
25+
- name: Run the default task
26+
run: bundle exec rake

.github/workflows/publish.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Publish
3+
4+
on: # yamllint disable-line rule:truthy
5+
workflow_dispatch:
6+
workflow_call:
7+
8+
jobs:
9+
gem:
10+
name: Build and publish gem
11+
uses: ./.github/workflows/gem.yaml
12+
secrets: inherit
13+
14+
# containers:
15+
# name: Build and publish OCI container images
16+
# uses: ./.github/workflows/container.yaml
17+
# secrets: inherit

.github/workflows/release.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: Release
3+
4+
on: # yamllint disable-line rule:truthy
5+
push:
6+
branches:
7+
- main
8+
workflow_dispatch:
9+
workflow_call:
10+
11+
jobs:
12+
validate:
13+
name: Validations
14+
uses: ./.github/workflows/validations.yaml
15+
16+
release:
17+
needs: [validate]
18+
name: Create a release
19+
runs-on: ubuntu-latest
20+
outputs:
21+
release_created: ${{ steps.release.outputs.release_created }}
22+
steps:
23+
-
24+
uses: actions/checkout@v4
25+
id: git-checkout
26+
with:
27+
fetch-tags: true
28+
-
29+
uses: googleapis/release-please-action@v4
30+
id: release
31+
with:
32+
config-file: .release-please-config.json
33+
manifest-file: .release-please-manifest.json
34+
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
35+
-
36+
id: debug
37+
env:
38+
RELEASE_CREATED: ${{ steps.release.outputs.release_created }}
39+
TRACE: ${{ secrets.ACTIONS_STEP_DEBUG || 'false' }}
40+
run: |
41+
if [ "$TRACE" != 'false' ]
42+
then
43+
printf 'Release created: %s\n' "$RELEASE_CREATED"
44+
fi
45+
46+
publish:
47+
if: needs.release.outputs.release_created
48+
needs: release
49+
name: Build and publish artifacts
50+
uses: ./.github/workflows/publish.yaml
51+
secrets: inherit

.github/workflows/validations.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: Validations
3+
4+
on: # yamllint disable-line rule:truthy
5+
workflow_dispatch:
6+
workflow_call:
7+
pull_request:
8+
9+
jobs:
10+
validate_ruby:
11+
name: Ruby Tests
12+
uses: ./.github/workflows/main.yaml

.release-please-config.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"packages": {
3+
".": {
4+
"changelog-path": "CHANGELOG.md",
5+
"release-type": "simple",
6+
"bump-minor-pre-major": true,
7+
"bump-patch-for-minor-pre-major": true,
8+
"draft": false,
9+
"prerelease": false,
10+
"version-file": ".version.txt",
11+
"extra-files": [
12+
{
13+
"type": "generic",
14+
"path": "lib/linear/version.rb"
15+
},
16+
{
17+
"type": "generic",
18+
"path": "oci/Gemfile"
19+
}
20+
],
21+
"exclude-paths": [
22+
".release-please-manifest.json",
23+
".version.txt",
24+
"lib/linear/version.rb",
25+
".rubocop.yml",
26+
".overcommit.yml",
27+
"coverage/coverage.json"
28+
]
29+
}
30+
},
31+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
32+
}

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "1.0.0"
3+
}

0 commit comments

Comments
 (0)