2
0

build(gha): Add automated CalVer releases (#539)

This commit is contained in:
Burak Yigit Kaya 2020-06-16 12:44:13 +03:00 committed by GitHub
parent cfaa368306
commit 2fc9811c74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 10 deletions

View File

@ -2,6 +2,7 @@ minVersion: "0.10.0"
github: github:
owner: getsentry owner: getsentry
repo: onpremise repo: onpremise
releaseBranchPrefix: releases
changelogPolicy: none changelogPolicy: none
artifactProvider: artifactProvider:
name: none name: none

1
.env
View File

@ -1,3 +1,4 @@
COMPOSE_PROJECT_NAME=sentry_onpremise COMPOSE_PROJECT_NAME=sentry_onpremise
SENTRY_EVENT_RETENTION_DAYS=90 SENTRY_EVENT_RETENTION_DAYS=90
SENTRY_VERSION=latest SENTRY_VERSION=latest
SYMBOLICATOR_VERSION=latest

View File

@ -1,14 +1,31 @@
on: on:
repository_dispatch: repository_dispatch:
types: [release] types: [release]
schedule:
# We want the release to be at 10 or 11am Pacific Time
# We also make this an hour after all others such as Sentry,
# Snuba, and Relay to make sure their releases finish.
- cron: '0 18 15 * *'
jobs: jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: "Release a new version" name: "Release a new version"
steps: steps:
- id: calver
if: ${{ !github.event.client_payload.version }}
run: echo "::set-output name=version::$(date +'%y.%-m.0')"
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: getsentry/craft-action@master - uses: getsentry/craft@master
with: with:
action: prepare action: prepare
version: ${{ github.event.client_payload.version }} version: ${{ github.event.client_payload.version || steps.calver.outputs.version }}
dry_run: ${{ github.event.client_payload.dry_run }} env:
DRY_RUN: ${{ github.event.client_payload.dry_run }}
- uses: getsentry/craft@master
with:
action: publish
version: ${{ github.event.client_payload.version || steps.calver.outputs.version }}
keep_branch: true
no_merge: true
env:
DRY_RUN: ${{ github.event.client_payload.dry_run }}

View File

@ -133,7 +133,7 @@ services:
command: '"*/5 * * * * gosu snuba snuba cleanup --dry-run False"' command: '"*/5 * * * * gosu snuba snuba cleanup --dry-run False"'
symbolicator: symbolicator:
<< : *restart_policy << : *restart_policy
image: 'getsentry/symbolicator:latest' image: 'getsentry/symbolicator:$SYMBOLICATOR_VERSION'
volumes: volumes:
- 'sentry-symbolicator:/data' - 'sentry-symbolicator:/data'
command: run command: run
@ -143,7 +143,7 @@ services:
build: build:
context: ./cron context: ./cron
args: args:
BASE_IMAGE: 'getsentry/symbolicator:latest' BASE_IMAGE: 'getsentry/symbolicator:$SYMBOLICATOR_VERSION'
command: '"55 23 * * * gosu symbolicator symbolicator cleanup"' command: '"55 23 * * * gosu symbolicator symbolicator cleanup"'
volumes: volumes:
- 'sentry-symbolicator:/data' - 'sentry-symbolicator:/data'
@ -174,7 +174,7 @@ services:
<< : *restart_policy << : *restart_policy
ports: ports:
- '9000:80/tcp' - '9000:80/tcp'
image: "nginx:1.16" image: 'nginx:1.16'
volumes: volumes:
- type: bind - type: bind
read_only: true read_only: true
@ -185,7 +185,7 @@ services:
- relay - relay
relay: relay:
<< : *restart_policy << : *restart_policy
image: "getsentry/relay:$SENTRY_VERSION" image: 'getsentry/relay:$SENTRY_VERSION'
volumes: volumes:
- type: bind - type: bind
read_only: true read_only: true

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
set -eux set -eu
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $SCRIPT_DIR/.. cd $SCRIPT_DIR/..
@ -7,5 +7,11 @@ cd $SCRIPT_DIR/..
OLD_VERSION="$1" OLD_VERSION="$1"
NEW_VERSION="$2" NEW_VERSION="$2"
VERSION=$2 SYMBOLICATOR_VERSION=$(curl -sSL 'https://api.github.com/repos/getsentry/symbolicator/git/refs/heads/master' | grep -Po '(?<=\"sha\": \")([a-f0-9]{5,40})(?=\",?)')
echo "New version: $VERSION"
sed -i -e "s/^SYMBOLICATOR_VERSION=.*\$/SYMBOLICATOR_VERSION=$SYMBOLICATOR_VERSION/" .env
sed -i -e "s/^SENTRY_VERSION=.*\$/SENTRY_VERSION=$NEW_VERSION/" .env
sed -i -e "s/^\# Sentry .* On-Premise/# Sentry $NEW_VERSION On-Premise/" README.md
echo "New version: $NEW_VERSION"
echo "New Symbolicator version: $SYMBOLICATOR_VERSION"