Skip to content

Commit f4d8eeb

Browse files
authored
ci: Add craft release configuration
2 parents bb9d1bf + e9e5b89 commit f4d8eeb

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

.craft.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
minVersion: 0.23.1
2+
changelogPolicy: simple
3+
preReleaseCommand: bash scripts/craft-pre-release.sh
4+
targets:
5+
- name: npm
6+
- name: github

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: "Action: Prepare Release"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: Version to release
7+
required: true
8+
force:
9+
description: Force a release even when there are release-blockers (optional)
10+
required: false
11+
merge_target:
12+
description: Target branch to merge into. Uses the default branch as a fallback (optional)
13+
required: false
14+
default: main
15+
jobs:
16+
release:
17+
runs-on: ubuntu-22.04
18+
name: "Release a new version"
19+
steps:
20+
- name: Get auth token
21+
id: token
22+
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
23+
with:
24+
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
25+
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
26+
- uses: actions/checkout@v4
27+
with:
28+
token: ${{ steps.token.outputs.token }}
29+
fetch-depth: 0
30+
- name: Prepare release
31+
uses: getsentry/action-prepare-release@v1
32+
env:
33+
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
34+
with:
35+
version: ${{ github.event.inputs.version }}
36+
force: ${{ github.event.inputs.force }}
37+
merge_target: ${{ github.event.inputs.merge_target }}
38+
craft_config_from_merge_target: true

scripts/craft-pre-release.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -eux
3+
# Move to the project root
4+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
cd $SCRIPT_DIR/..
6+
OLD_VERSION="${1}"
7+
NEW_VERSION="${2}"
8+
# Do not tag and commit changes made by "npm version"
9+
export npm_config_git_tag_version=false
10+
npm version "${NEW_VERSION}"

0 commit comments

Comments
 (0)