Skip to content

Commit 2fc9811

Browse files
authored
build(gha): Add automated CalVer releases (#539)
1 parent cfaa368 commit 2fc9811

File tree

5 files changed

+35
-10
lines changed

5 files changed

+35
-10
lines changed

.craft.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ minVersion: "0.10.0"
22
github:
33
owner: getsentry
44
repo: onpremise
5+
releaseBranchPrefix: releases
56
changelogPolicy: none
67
artifactProvider:
78
name: none

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
COMPOSE_PROJECT_NAME=sentry_onpremise
22
SENTRY_EVENT_RETENTION_DAYS=90
33
SENTRY_VERSION=latest
4+
SYMBOLICATOR_VERSION=latest

.github/workflows/release.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
11
on:
22
repository_dispatch:
33
types: [release]
4+
schedule:
5+
# We want the release to be at 10 or 11am Pacific Time
6+
# We also make this an hour after all others such as Sentry,
7+
# Snuba, and Relay to make sure their releases finish.
8+
- cron: '0 18 15 * *'
49
jobs:
510
release:
611
runs-on: ubuntu-latest
712
name: "Release a new version"
813
steps:
14+
- id: calver
15+
if: ${{ !github.event.client_payload.version }}
16+
run: echo "::set-output name=version::$(date +'%y.%-m.0')"
917
- uses: actions/checkout@v2
10-
- uses: getsentry/craft-action@master
18+
- uses: getsentry/craft@master
1119
with:
1220
action: prepare
13-
version: ${{ github.event.client_payload.version }}
14-
dry_run: ${{ github.event.client_payload.dry_run }}
21+
version: ${{ github.event.client_payload.version || steps.calver.outputs.version }}
22+
env:
23+
DRY_RUN: ${{ github.event.client_payload.dry_run }}
24+
- uses: getsentry/craft@master
25+
with:
26+
action: publish
27+
version: ${{ github.event.client_payload.version || steps.calver.outputs.version }}
28+
keep_branch: true
29+
no_merge: true
30+
env:
31+
DRY_RUN: ${{ github.event.client_payload.dry_run }}

docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ services:
133133
command: '"*/5 * * * * gosu snuba snuba cleanup --dry-run False"'
134134
symbolicator:
135135
<< : *restart_policy
136-
image: 'getsentry/symbolicator:latest'
136+
image: 'getsentry/symbolicator:$SYMBOLICATOR_VERSION'
137137
volumes:
138138
- 'sentry-symbolicator:/data'
139139
command: run
@@ -143,7 +143,7 @@ services:
143143
build:
144144
context: ./cron
145145
args:
146-
BASE_IMAGE: 'getsentry/symbolicator:latest'
146+
BASE_IMAGE: 'getsentry/symbolicator:$SYMBOLICATOR_VERSION'
147147
command: '"55 23 * * * gosu symbolicator symbolicator cleanup"'
148148
volumes:
149149
- 'sentry-symbolicator:/data'
@@ -174,7 +174,7 @@ services:
174174
<< : *restart_policy
175175
ports:
176176
- '9000:80/tcp'
177-
image: "nginx:1.16"
177+
image: 'nginx:1.16'
178178
volumes:
179179
- type: bind
180180
read_only: true
@@ -185,7 +185,7 @@ services:
185185
- relay
186186
relay:
187187
<< : *restart_policy
188-
image: "getsentry/relay:$SENTRY_VERSION"
188+
image: 'getsentry/relay:$SENTRY_VERSION'
189189
volumes:
190190
- type: bind
191191
read_only: true

scripts/bump-version.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
#!/bin/bash
2-
set -eux
2+
set -eu
33

44
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
55
cd $SCRIPT_DIR/..
66

77
OLD_VERSION="$1"
88
NEW_VERSION="$2"
99

10-
VERSION=$2
11-
echo "New version: $VERSION"
10+
SYMBOLICATOR_VERSION=$(curl -sSL 'https://api.github.com/repos/getsentry/symbolicator/git/refs/heads/master' | grep -Po '(?<=\"sha\": \")([a-f0-9]{5,40})(?=\",?)')
11+
12+
sed -i -e "s/^SYMBOLICATOR_VERSION=.*\$/SYMBOLICATOR_VERSION=$SYMBOLICATOR_VERSION/" .env
13+
sed -i -e "s/^SENTRY_VERSION=.*\$/SENTRY_VERSION=$NEW_VERSION/" .env
14+
sed -i -e "s/^\# Sentry .* On-Premise/# Sentry $NEW_VERSION On-Premise/" README.md
15+
16+
echo "New version: $NEW_VERSION"
17+
echo "New Symbolicator version: $SYMBOLICATOR_VERSION"

0 commit comments

Comments
 (0)