name: 'Sentry Release' description: 'GitHub Action for creating a release on Sentry' author: 'Sentry' inputs: environment: description: |- Set the environment for this release. E.g. "production" or "staging". Omit to skip adding deploy to release. required: false sourcemaps: description: |- Space-separated list of paths to JavaScript source maps. Omit to skip uploading sourcemaps. required: false inject: description: |- Injects Debug IDs into source files and source maps to ensure proper un-minifcation of your stacktraces. Does nothing if "sourcemaps" was not set. default: true required: false dist: description: |- Unique identifier for the distribution, used to further segment your release. Usually your build number. required: false finalize: description: |- When false, omit marking the release as finalized and released. default: true ignore_missing: description: |- When the flag is set and the previous release commit was not found in the repository, will create a release with the default commits count instead of failing the command. default: false required: false ignore_empty: description: |- When the flag is set, command will not fail and just exit silently if no new commits for a given release have been found. default: false required: false started_at: description: |- Unix timestamp of the release start date. Omit for current time. required: false version: description: |- Identifier that uniquely identifies the release. Should match the "release" property in your Sentry SDK init call if one was set. Omit to auto-generate one. deprecationMessage: |- Deprecated: Use "release" instead. required: false release: description: |- Identifier that uniquely identifies the release. Should match the "release" property in your Sentry SDK init call if one was set. Omit to auto-generate one. required: false version_prefix: description: |- Value prepended to auto-generated version. deprecationMessage: |- Deprecated: Use "release_prefix" instead. required: false release_prefix: description: |- Value prepended to auto-generated release version. required: false set_commits: description: |- Specify whether to set commits for the release. When "manual", you need to provide the repository, commit, and previous commit. One of: "auto", "skip", "manual" required: false repo: description: |- The repository to set commits for in "repo-owner/repo-name" format. Only used when "set_commits" is "manual". required: false commit: description: |- The commit SHA of the current release you are creating. Only used when "set_commits" is "manual". required: false previous_commit: description: |- The commit SHA of the previous release. Required when "set_commits" is "manual". required: false projects: description: |- Space-separated list of projects. Defaults to the env variable "SENTRY_PROJECT" if not provided. required: false url_prefix: description: |- Adds a prefix to source map urls after stripping them. required: false strip_common_prefix: description: |- Will remove a common prefix from uploaded filenames. Useful for removing a path that is build-machine-specific. Note: Will not remove common prefixes across two or more directories provided to "sourcemap". E.g. Setting "sourcemap": "./dist/js ./dist/asset/js" will strip "./dist" for the first directory and "./dist/assets/js" for the default: false required: false working_directory: description: |- Directory to collect sentry release information from. Useful when collecting information from a non-standard checkout directory. required: false disable_telemetry: description: |- The action sends telemetry data and crash reports to Sentry. This helps us improve the action. You can turn this off by setting this flag. default: false required: false disable_safe_directory: description: |- The action needs access to the repo it runs in. For that we need to configure git to mark the repo directory a safe directory. You can turn this off by setting this flag. default: false required: false runs: using: 'composite' steps: # For actions running on a linux runner, we use a docker # approach as it's faster and encapsulates everything needed # to run the action. - name: Run docker image if: runner.os != 'macOS' && runner.os != 'Windows' env: # Composite actions don't pass the outer action's inputs # down into these steps, so we have to replicate all inputs to be accessible # via @actions/core here and in the `Run Release Action` step further down. INPUT_ENVIRONMENT: ${{ inputs.environment }} INPUT_INJECT: ${{ inputs.inject }} INPUT_SOURCEMAPS: ${{ inputs.sourcemaps }} INPUT_DIST: ${{ inputs.dist }} INPUT_FINALIZE: ${{ inputs.finalize }} INPUT_IGNORE_MISSING: ${{ inputs.ignore_missing }} INPUT_IGNORE_EMPTY: ${{ inputs.ignore_empty }} INPUT_STARTED_AT: ${{ inputs.started_at }} INPUT_VERSION: ${{ inputs.version }} INPUT_RELEASE: ${{ inputs.release }} INPUT_VERSION_PREFIX: ${{ inputs.version_prefix }} INPUT_RELEASE_PREFIX: ${{ inputs.release_prefix }} INPUT_SET_COMMITS: ${{ inputs.set_commits }} INPUT_REPO: ${{ inputs.repo }} INPUT_COMMIT: ${{ inputs.commit }} INPUT_PREVIOUS_COMMIT: ${{ inputs.previous_commit }} INPUT_PROJECTS: ${{ inputs.projects }} INPUT_URL_PREFIX: ${{ inputs.url_prefix }} INPUT_STRIP_COMMON_PREFIX: ${{ inputs.strip_common_prefix }} INPUT_WORKING_DIRECTORY: ${{ inputs.working_directory }} INPUT_DISABLE_TELEMETRY: ${{ inputs.disable_telemetry }} INPUT_DISABLE_SAFE_DIRECTORY: ${{ inputs.disable_safe_directory }} uses: docker://ghcr.io/getsentry/action-release-image:ab-add-dotagents # For actions running on macos or windows runners, we use a composite # action approach which allows us to install the arch specific sentry-cli # binary that's needed for the runner. # This is slower than the docker approach but runs on macos and windows. - name: Mark GitHub workspace a safe directory in git if: ${{ (runner.os == 'macOS' || runner.os == 'Windows') && inputs.disable_safe_directory != 'true' }} shell: bash run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" # Save the current Node version before changing it - name: Save current Node version if: runner.os == 'macOS' || runner.os == 'Windows' id: node_version shell: bash run: | if command -v node &> /dev/null; then echo "NODE_VERSION=$(node --version | sed 's/v//')" >> $GITHUB_OUTPUT fi - name: Setup node if: runner.os == 'macOS' || runner.os == 'Windows' uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 with: # setup-node doesn't allow absolute paths, so we can't # just use `github.action_path` to read this out from the `package.json` # any changes to the runtime need to be reflected here node-version: 24.14.1 package-manager-cache: false - name: Install Sentry CLI v2 if: runner.os == 'macOS' || runner.os == 'Windows' shell: bash run: npm install --no-package-lock @sentry/cli@^2.4 working-directory: ${{ github.action_path }} - name: Run Release Action if: runner.os == 'macOS' || runner.os == 'Windows' env: # Composite actions don't pass the outer action's inputs # down into these steps, so we have to replicate all inputs to be accessible # via @actions/core INPUT_ENVIRONMENT: ${{ inputs.environment }} INPUT_INJECT: ${{ inputs.inject }} INPUT_SOURCEMAPS: ${{ inputs.sourcemaps }} INPUT_DIST: ${{ inputs.dist }} INPUT_FINALIZE: ${{ inputs.finalize }} INPUT_IGNORE_MISSING: ${{ inputs.ignore_missing }} INPUT_IGNORE_EMPTY: ${{ inputs.ignore_empty }} INPUT_STARTED_AT: ${{ inputs.started_at }} INPUT_VERSION: ${{ inputs.version }} INPUT_RELEASE: ${{ inputs.release }} INPUT_VERSION_PREFIX: ${{ inputs.version_prefix }} INPUT_RELEASE_PREFIX: ${{ inputs.release_prefix }} INPUT_SET_COMMITS: ${{ inputs.set_commits }} INPUT_REPO: ${{ inputs.repo }} INPUT_COMMIT: ${{ inputs.commit }} INPUT_PREVIOUS_COMMIT: ${{ inputs.previous_commit }} INPUT_PROJECTS: ${{ inputs.projects }} INPUT_URL_PREFIX: ${{ inputs.url_prefix }} INPUT_STRIP_COMMON_PREFIX: ${{ inputs.strip_common_prefix }} INPUT_WORKING_DIRECTORY: ${{ inputs.working_directory }} INPUT_DISABLE_TELEMETRY: ${{ inputs.disable_telemetry }} INPUT_DISABLE_SAFE_DIRECTORY: ${{ inputs.disable_safe_directory }} shell: bash run: npm run start working-directory: ${{ github.action_path }} # Restore the original Node version - name: Restore original Node version if: (runner.os == 'macOS' || runner.os == 'Windows') && steps.node_version.outputs.NODE_VERSION != '' uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 with: node-version: ${{ steps.node_version.outputs.NODE_VERSION }} package-manager-cache: false branding: icon: 'triangle' color: 'purple'