diff --git a/.craft.yml b/.craft.yml new file mode 100644 index 0000000..98e19d5 --- /dev/null +++ b/.craft.yml @@ -0,0 +1,6 @@ +minVersion: 0.23.1 +changelogPolicy: simple +preReleaseCommand: bash scripts/craft-pre-release.sh +targets: + - name: npm + - name: github diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0763494 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: "Action: Prepare Release" +on: + workflow_dispatch: + inputs: + version: + description: Version to release + required: true + force: + description: Force a release even when there are release-blockers (optional) + required: false + merge_target: + description: Target branch to merge into. Uses the default branch as a fallback (optional) + required: false + default: main +jobs: + release: + runs-on: ubuntu-22.04 + name: "Release a new version" + steps: + - name: Get auth token + id: token + uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0 + with: + app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }} + private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }} + - uses: actions/checkout@v4 + with: + token: ${{ steps.token.outputs.token }} + fetch-depth: 0 + - name: Prepare release + uses: getsentry/action-prepare-release@v1 + env: + GITHUB_TOKEN: ${{ steps.token.outputs.token }} + with: + version: ${{ github.event.inputs.version }} + force: ${{ github.event.inputs.force }} + merge_target: ${{ github.event.inputs.merge_target }} + craft_config_from_merge_target: true diff --git a/scripts/craft-pre-release.sh b/scripts/craft-pre-release.sh new file mode 100755 index 0000000..c1d3e35 --- /dev/null +++ b/scripts/craft-pre-release.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -eux +# Move to the project root +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $SCRIPT_DIR/.. +OLD_VERSION="${1}" +NEW_VERSION="${2}" + # Do not tag and commit changes made by "npm version" +export npm_config_git_tag_version=false +npm version "${NEW_VERSION}"