Skip to content

Commit 09e4c8a

Browse files
chore(docs): Extract development documentation from README into new docs folder (#230)
* chore(docs): Extract development documentation from README into new docs folder * Add CODEOWNER * add link to sourcemaps we only link to that release workflow page, which i think is meh * important note on checkout version @andreiborza should we update the example to use v4, latest version from the checkout action? * Formatting and further clarification on checkout action * Update organization auth token prerequisite --------- Co-authored-by: Steven Eubank <[email protected]>
1 parent 6dca92a commit 09e4c8a

File tree

5 files changed

+169
-125
lines changed

5 files changed

+169
-125
lines changed

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @andreiborza

CONTRIBUTING CONTRIBUTING.md

File renamed without changes.

README.md

+26-125
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1+
<p align="center">
2+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3+
<picture>
4+
<source srcset="https://sentry-brand.storage.googleapis.com/sentry-logo-white.png" media="(prefers-color-scheme: dark)" />
5+
<source srcset="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" />
6+
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" alt="Sentry" width="280">
7+
</picture>
8+
</a>
9+
</p>
10+
111
# Sentry Release GitHub Action
212

3-
**NOTE**: Currently only available for Linux runners. See [this issue](https://github.com/getsentry/action-release/issues/58) for more details.
13+
> [!IMPORTANT]
14+
> This action is currently only available for Linux runners.
15+
> See [this issue](https://github.com/getsentry/action-release/issues/58) for more details.
416
517
Automatically create a Sentry release in a workflow.
618

@@ -11,26 +23,25 @@ A release is a version of your code that can be deployed to an environment. When
1123
- Resolve issues by including the issue number in your commit message
1224
- Receive email notifications when your code gets deployed
1325

14-
Additionally, releases are used for applying source maps to minified JavaScript to view original, untransformed source code. You can learn more about releases in the [releases documentation](https://docs.sentry.io/workflow/releases).
26+
Additionally, releases are used for applying [source maps](https://docs.sentry.io/platforms/javascript/sourcemaps/) to minified JavaScript to view original, untransformed source code. You can learn more about releases in the [releases documentation](https://docs.sentry.io/workflow/releases).
1527

1628
## Prerequisites
1729

18-
### Create a Sentry Internal Integration
19-
20-
NOTE: You have to be an admin in your Sentry org to create this.
21-
22-
For this action to communicate securely with Sentry, you'll need to create a new internal integration. In Sentry, navigate to: _Settings > Developer Settings > Custom Integrations > Create New Integration > Internal Integration_.
23-
24-
Give your new integration a name (for example, "GitHub Action Release Integration”) and specify the necessary permissions. In this case, we need Admin access for “Release” and Read access for “Organization”.
30+
### Create an Organization Auth Token
2531

26-
![View of internal integration permissions.](images/internal-integration-permissions.png)
27-
28-
Click “Save” at the bottom of the page, then go back into your newly created integration and click "New Token". Grab this newly generated token and use it as your `SENTRY_AUTH_TOKEN`. We recommend you store this as an [encrypted secret](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions).
32+
> [!NOTE]
33+
> You have to be an admin in your Sentry org to create this.
34+
35+
For this action to communicate securely with Sentry, you'll need to [create an organization auth token](https://docs.sentry.io/account/auth-tokens/#organization-auth-tokens).
36+
Copy the generated token and use it as your `SENTRY_AUTH_TOKEN`. We recommend storing it as an [encrypted secret](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions).
2937

3038
## Usage
3139

3240
Adding the following to your workflow will create a new Sentry release and tell Sentry that you are deploying to the `production` environment.
33-
41+
42+
> [!IMPORTANT]
43+
> Make sure you are using at least v3 of [actions/checkout](https://github.com/actions/checkout) with `fetch-depth: 0`, issues commonly occur with older versions.
44+
3445
```yaml
3546
- uses: actions/checkout@v3
3647
with:
@@ -106,124 +117,14 @@ Adding the following to your workflow will create a new Sentry release and tell
106117
SENTRY_URL: https://sentry.example.com/
107118
```
108119

109-
## Releases
110-
111-
The `build.yml` workflow will build a Docker image every time a pull request merges to `master` and upload it to [the GitHub registry](https://github.com/orgs/getsentry/packages?repo_name=action-release), thus, effectively being live for everyone even if we do not bump the version.
112-
113-
NOTE: Unfortunately, we only use the `latest` tag for the Docker image, thus, making use of a version with the action innefective (e.g. `v1` vs `v1.3.0`). See #129 on how to fix this.
114-
115-
NOTE: Right now, our Docker image publishing is decoupled from `tag` creation in the repository. We should only publish a specific Docker tag when we create a tag (you can make GitHub workflows listen to this). See #102 for details. Once this is fixed merges to `master` will not make the Docker image live and the following paragraph will be legit.
116-
117-
When you are ready to make a release, open a [new release checklist issue](https://github.com/getsentry/action-release/issues/new?assignees=&labels=&template=release-checklist.md&title=New+release+checklist+for+%5Bversion+number%5D) and follow the steps in there.
118-
119-
The Docker build is [multi-staged](https://github.com/getsentry/action-release/blob/master/Dockerfile) in order to make the final image used by the action as small as possible to reduce network transfer (use `docker images` to see the sizes of the images).
120-
121-
### End to end testing on GitHub's CI
122-
123-
The first job in `test.yml` has instructions on how to tweak a job in order to execute your changes as part of the PR.
124-
125-
NOTE: Contributors will need to create an internal integration in their Sentry org and need to be an admin. See `Prerequisites` section above.
126-
127-
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.
128-
129-
## Development
130-
131-
If your change impacts the options used for the action, you need to update the README.md with the new options.
132-
133-
## Testing
134-
135-
You can run the unit tests with `yarn test`.
136-
137-
### Test your own repo against an action-release PR
138-
139-
NOTE: This section has not been fully tested but it should work with a bit of investment.
140-
141-
NOTE: This assumes that you have gone through the `Usage` section and have managed to get your Github repository to have worked with this action.
142-
143-
NOTE: Once we start producing Docker images for PRs we can get rid of the need of using the `sed` command below.
144-
145-
Step 1 - action-release changes (This is your PR with your code changes):
146-
* Make changes to your action-release branch and push it
147-
* Run this command, commit the changes and push it
148-
* This will cause the action-release to be built using the `Dockerfile`
149-
* You will need to revert this change once your changes are approved and ready to be merged
150-
151-
```shell
152-
sed -i .backup 's|docker://ghcr.io/getsentry/action-release-image:latest|Dockerfile|' action.yml
153-
```
154-
155-
Step 2 - Test out your action-release changes on your own repo
156-
* Get the sha for the latest commit on Step 1
157-
* Modify your usage of action-release to point to that commit
158-
* If you're using a fork, edit the getsentry org in the string below
159-
160-
```yml
161-
- name: Sentry Release
162-
uses: getsentry/action-release@<github_action_commit>
163-
env:
164-
# You will remove this in the next steps when ready
165-
MOCK: true
166-
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
167-
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
168-
# If you specify a Github environment for the branch from where you create
169-
# releases from (e.g. master), you can then specify a repository-level variable
170-
# for all other branches. This allows using a second project for end-to-end testing
171-
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
172-
```
173-
174-
NOTE: If you want to do local testing read the next section, otherwise, keep reading.
175-
176-
NOTE: Only remove `MOCK: true` once you follow the steps below that will allow you to use two different projects. This will avoid polutting your Sentry releases for your existing Sentry project.
177-
178-
<!-- Add link to test.yml after PR 153 merges -->
179-
180-
Step 3 - Create a new Sentry project under your existing Sentry org (only this one time)
181-
Step 4 - Create an environment variable in Github for the branch you release from (e.g. `master`) and define the same variable as a repository variable which all other branches will use (read: your PRs)
182-
183-
<!-- <TODO add screenshot here> -->
184-
Step 5 - Comment out the MOCK env variable from step 2
185-
Step 6 - Push to Github and the CI will do an end-to-end run!
186-
187-
NOTE: As mentioned, this section not been tested. Please try it out and let me know if it works for you.
188-
189-
### Local testing via act
190-
191-
NOTE: You should test out this whole section to see if it still makes sense to use this testing approach and/or if to only use the one above.
192-
193-
[Here's a repo](https://github.com/scefali/github-actions-react/blob/master/.github/workflows/deploy.yml) you can clone to test out this section.
194-
195-
Step 1 - Install `act` in Mac with:
196-
```bash
197-
brew install act
198-
```
199-
200-
NOTE: Make sure you commit your changes in your branch before running `act`.
201-
202-
Step 3 - Create an integration and set the SENTRY_AUTH_TOKEN (see `Usage` section in this doc)
203-
204-
NOTE: If you have `direnv` installed, you can define the variable within your repo in an `.env` file.
205-
206-
Step 4 - Run the action
207-
208-
```bash
209-
act -s SENTRY_ORG={your_org_slug} -s SENTRY_PROJECT={your_project_slug}
210-
```
211-
212-
NOTE: Make sure that `SENTRY_AUTH_TOKEN` is loaded as an env variable.
213-
NOTE: If you're running and M1 chipset instead of Intel you can ignore the following message:
214-
```
215-
WARN ⚠ You are using Apple M1 chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'
216-
```
217-
218-
Step 5 - Choose Medium Docker builds
219120

220121
## Contributing
221122

222-
See the [Contributing Guide](https://github.com/getsentry/action-release/blob/master/CONTRIBUTING).
123+
See the [Contributing Guide](./CONTRIBUTING.md).
223124

224125
## License
225126

226-
See the [License File](https://github.com/getsentry/action-release/blob/master/LICENSE).
127+
See the [License File](./LICENSE)
227128

228129
## Troubleshooting
229130

docs/development.md

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Development of `getsentry/action-release`
2+
3+
This document aims to provide guidelines for maintainers and contains information on how to develop and test this action.
4+
For info on how to release changes, follow [publishing-a-release](publishing-a-release.md).
5+
6+
## Development
7+
8+
The action is using `@sentry/cli` under the hood and is written in TypeScript. See `src/main.ts` to get started.
9+
10+
Options to the action are exposed via `action.yml`, changes that impact options need to be documented in the `README.md`.
11+
12+
Telemetry for internal development is collected using `@sentry/node`, see `src/telemetry.ts` for utilities.
13+
14+
## Testing
15+
16+
You can run unit tests with `yarn test`.
17+
18+
### E2E testing on GitHub's CI
19+
20+
The first job in [test.yml](../.github/workflows/test.yml) has instructions on how to tweak a job in order to execute your changes as part of the PR.
21+
22+
> [!NOTE]
23+
> Contributors will need to create an internal integration in their Sentry org and need to be an admin.
24+
> See [#Prerequisites](../README.md#prerequisites).
25+
26+
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.
27+
28+
### Test your own repo against an action-release PR
29+
30+
> [!NOTE]
31+
> This assumes that you have gone through the [#Usage](../README.md#usage) section and have managed to get your GitHub repository to have worked with this action.
32+
33+
> [!NOTE]
34+
> Once we start producing Docker images for PRs we can get rid of the need of using the `sed` command below.
35+
36+
**Step 1**
37+
* Create a branch, make changes and push it
38+
* Run this command, commit the changes and push it
39+
* This will cause the action-release to be built using the `Dockerfile`
40+
* You will need to revert this change once your changes are approved and ready to be merged
41+
42+
```shell
43+
sed -i .backup 's|docker://ghcr.io/getsentry/action-release-image:latest|Dockerfile|' action.yml
44+
```
45+
46+
**Step 2**
47+
Test out your action-release changes on your own repo.
48+
* Get the sha for the latest commit on **Step 1**
49+
* Modify your usage of action-release to point to that commit (if you're using a fork, edit the `getsentry` org in the string below)
50+
51+
Example:
52+
53+
```yml
54+
- name: Sentry Release
55+
uses: getsentry/action-release@<latest commit sha>
56+
env:
57+
# You will remove this in the next steps when ready
58+
MOCK: true
59+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
60+
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
61+
# If you specify a GitHub environment for the branch from where you create
62+
# releases from (e.g. master), you can then specify a repository-level variable
63+
# for all other branches. This allows using a second project for end-to-end testing
64+
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
65+
```
66+
67+
> [!NOTE]
68+
> If you want to locally test the action, read the next section, otherwise, keep reading.
69+
70+
> [!NOTE]
71+
> Only remove `MOCK: true` once you follow the steps below that will allow you to use two different projects. This will avoid polluting your Sentry releases for your existing Sentry project.
72+
73+
**Step 3**
74+
Create a new Sentry project under your existing Sentry org (only this one time).
75+
76+
**Step 4**
77+
Create an environment variable in GitHub for the branch you release from (e.g. `master`) and define the same variable as a repository variable which all other branches will use (i.e. your PR's branch)
78+
79+
**Step 5**
80+
Comment out the MOCK env variable from **Step 2**.
81+
82+
**Step 6**
83+
Push to GitHub and the CI will do an end-to-end run!
84+
85+
### Local testing via act
86+
87+
Alternatively, you can test the action locally using [act](https://github.com/nektos/act).
88+
89+
To get started, you can clone [this sample repo](https://github.com/scefali/github-actions-react/blob/master/.github/workflows/deploy.yml) to test locally.
90+
91+
**Step 1**
92+
Install `act`.
93+
94+
```bash
95+
brew install act
96+
```
97+
98+
> [!NOTE]
99+
> Make sure you commit your changes in your branch before running `act`.
100+
101+
**Step 3**
102+
Create an integration and set the SENTRY_AUTH_TOKEN (see [#Usage](../README.md#usage)).
103+
104+
> [!NOTE]
105+
> If you have `direnv` installed, you can define the variable within your repo in an `.env` file.
106+
107+
**Step 4**
108+
Run the action.
109+
110+
```bash
111+
act -s SENTRY_ORG={your_org_slug} -s SENTRY_PROJECT={your_project_slug}
112+
```
113+
114+
> [!NOTE]
115+
> Make sure that `SENTRY_AUTH_TOKEN` is loaded as an env variable.
116+
117+
**Step 5**
118+
Choose Medium Docker builds.

docs/publishing-a-release.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Publishing a release
2+
3+
The [build.yml](../.github/workflows/build.yml) workflow will build a Docker image every time a pull request merges to `master` and upload it to [the GitHub registry](https://github.com/orgs/getsentry/packages?repo_name=action-release).
4+
5+
> [!WARNING]
6+
> Merging pull requests into `master` means changes are live for anyone who uses the action regardless of bumping the version.
7+
> Be extremely careful and intentional with changes and ensure properly testing them before merging, see [#Testing](development.md#testing) for more info.
8+
effectively being live for everyone even if we do not bump the version.
9+
10+
> [!NOTE]
11+
> Unfortunately, we only use the `latest` tag for the Docker image, thus, making use of a version with the action ineffective (e.g. `v1` vs `v1.3.0`).
12+
> See #129 on how to fix this.
13+
14+
> [!NOTE]
15+
> At the moment our Docker image publishing is decoupled from `tag` creation in the repository.
16+
> We should only publish a specific Docker tag when we create a tag (you can make GitHub workflows listen to this). See #102 for details.
17+
> Once this is fixed, merges to `master` will not make the Docker image live.
18+
19+
When you are ready to make a release, open a [new release checklist issue](https://github.com/getsentry/action-release/issues/new?assignees=&labels=&template=release-checklist.md&title=New+release+checklist+for+%5Bversion+number%5D) and follow the steps in there.
20+
21+
> [!NOTE]
22+
> At the moment releases are only used to inform users of changes.
23+
24+
The Docker build is [multi-staged](https://github.com/getsentry/action-release/blob/master/Dockerfile) in order to make the final image used by the action as small as possible to reduce network transfer (use `docker images` to see the sizes of the images).

0 commit comments

Comments
 (0)