Files
Andrei 6a76b88afc feat: Use hybrid docker/composite action approach (#265)
* feat: Use hybrid approach depending on runner

* Fix tag

* Update dist

* Add fetch depth to test

* Add dependcy on docker-build job for test action

* Improve branch extraction naming, add npm scripts to bump docker tags

* Pass inputs along

* Run tests on workflow_run completed

* Update workflow run trigger

* Fix fetch-depth

* Update comment

* Update workflow naming

* Update workflow names

* Merge test.yml into build.yml to run tests after building

* Always install node/npm on non Linux runners, update development docs

* Fail the job if docker tag matches MAJOR.MINOR.PATCH naming

* Some cleanup

* Test with major.minor.patch tag

* Rework error message

* Update development doc

* Add logic to commit `master` docker tag on master runs

* Allow linting in parallel

* Add pre-commit to the repo

* Add Makefile to install pre-commit and yarrn deps

* Skip pre-commit in action when committing the master tag back

* Add note on `yarn set-docker-tag-from-branch` to development doc

* Add formatting and linting to pre-commit

* Mark e2e tests in build.yml better

* Don't pass filenames to local hooks, fix dockerfile casing

* Add changelog
2025-02-27 11:12:21 +01:00

72 lines
3.0 KiB
Markdown

# Pre-requirements
This setup assumes you have [Yarn][Yarn], [Volta][volta] and [pre-commit][pre-commit] installed.
After cloning the repo, run
```bash
# Install or update application dependencies
make
```
# Development of `getsentry/action-release`
This document aims to provide guidelines for maintainers and contains information on how to develop and test this action.
For info on how to release changes, follow [publishing-a-release](publishing-a-release.md).
The action is a composite GitHub Action.
On Linux runners, the action executes the underlying JavaScript script
via a Docker image we publish.
For Mac OS and Windows runners, the action cannot run the Docker image and instead installs
the `@sentry/cli` dependency corresponding to the architecture of the runner and then executes the underlying JavaScript
distribution.
This split in architecture is done to optimize the run-time of the action but at the same time support non-Linux runners.
This action runs fastest on Linux runners.
## Development
The action is using `@sentry/cli` under the hood and is written in TypeScript. See `src/main.ts` to get started.
Options to the action are exposed via `action.yml`, changes that impact options need to be documented in the `README.md`.
> [!NOTE]
> Actions have to be exposed in 3 places in `action.yml`
>
> 1. Under the `inputs` field - These are the actual inputs exposed to users
> 2. Under the `env` field inside the `Run docker image` step. All inputs have to be mapped from inputs to `INPUT_X` env variables.
> 3. Under the `env` field inside the `Run Release Action
Telemetry for internal development is collected using `@sentry/node`, see `src/telemetry.ts` for utilities.
## Development steps
> [!NOTE]
> Contributors will need to create an internal integration in their Sentry org and need to be an admin.
> See [#Prerequisites](../README.md#prerequisites).
Members of this repo will not have to set anything up since [the integration](https://sentry-ecosystem.sentry.io/settings/developer-settings/end-to-end-action-release-integration-416eb2/) is already set-up. Just open the PR and you will see [a release created](https://sentry-ecosystem.sentry.io/releases/?project=4505075304693760) for your PR.
1. Create a branch
2. Run `yarn set-docker-tag-from-branch` to set a docker tag based on your github branch name. This is important so that the action gets its own Docker image, allowing you to test the action in a different repo.
3. Make changes
4. If possible, add unit and E2E tests (inside `.github/workflows/build.yml`)
5. Run `yarn install` to install deps
6. Run `yarn build` to build the action
7. Commit the changes and the build inside `dist/`
If you forget to run `yarn set-docker-tag-from-branch` the repo's pre-commit hooks will do it for you and fail the commit.
Just add the changes to staging and commit again.
## Testing
You can run unit tests with `yarn test`.
### Troubleshooting
- If the `verify-dist` action fails for your PR, you likely forgot to commit the build output.
Run `yarn install` and `yarn build` and commit the `dist/` folder.