-
Notifications
You must be signed in to change notification settings - Fork 57
chore(action): Rework action to be a composite action #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
13bddeb
5e197bd
c6d6b15
d903ebf
92c305a
640dd4d
a0def43
9b2d6dc
9029bd2
c3e1fdc
ea32e3d
d4aaaaa
9613ff9
7f9cbfc
32140db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Releases always publish a `v[major].[minor].[patch]` tag | ||
# This action creates/updates `v[major]` and `v[major].[minor]` tags | ||
name: Create release tags | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
create-tags: | ||
name: Create release tags for major and minor versions | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.release.tag_name }} | ||
|
||
- name: Set git user to getsentry-bot | ||
run: | | ||
echo "GIT_COMMITTER_NAME=getsentry-bot" >> $GITHUB_ENV; | ||
echo "GIT_AUTHOR_NAME=getsentry-bot" >> $GITHUB_ENV; | ||
echo "[email protected]" >> $GITHUB_ENV; | ||
|
||
- name: Create and push major and minor version tags | ||
run: | | ||
MAJOR_VERSION=$(echo '${{ github.event.release.tag_name }}' | cut -d. -f1) | ||
MINOR_VERSION=$(echo '${{ github.event.release.tag_name }}' | cut -d. -f1-2) | ||
git tag -f $MAJOR_VERSION | ||
git tag -f $MINOR_VERSION | ||
git push -f origin $MAJOR_VERSION $MINOR_VERSION | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just a question: this already handles previously set and pushed tags when we associate them with new commits? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, tags will be force updated and force pushed so e.g. the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,103 @@ | ||
name: "integration tests" | ||
name: Integration Tests | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
- "**.md" | ||
push: | ||
branches: | ||
- master | ||
- release/** | ||
paths-ignore: | ||
- "**.md" | ||
|
||
env: | ||
# Variables defined in the repository | ||
SENTRY_ORG: ${{ vars.SENTRY_ORG }} | ||
# For master we have an environment variable that selects the action-release project | ||
# For master, we have an environment variable that selects the action-release project | ||
# instead of action-release-prs | ||
# For other branches: https://sentry-ecosystem.sentry.io/releases/?project=4505075304693760 | ||
# For master branch: https://sentry-ecosystem.sentry.io/releases/?project=6576594 | ||
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }} | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install | ||
run: yarn install | ||
|
||
- name: Check format | ||
run: yarn format-check | ||
|
||
- name: Lint | ||
run: yarn lint | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
# You're welcome to make changes on this job as part of your PR in order to test out your changes | ||
# We can always undo the changes once we're satisfied with the results | ||
# | ||
# Secrets on this repo do not get shared with PRs opened on a fork, thus, | ||
# add SENTRY_AUTH_TOKEN as a secret to your fork if you want to use this job. | ||
# Checkout the README.md on how to create the internal integration (read: auth token) | ||
create-real-release-per-push: | ||
name: "Test current action" | ||
runs-on: ubuntu-latest | ||
# XXX: This job will fail for forks, skip step on forks and let contributors tweak it when ready | ||
if: github.ref != 'refs/heads/master' | ||
create-staging-release-per-push: | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
runs-on: ${{ matrix.os }} | ||
name: Test current action | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
# For PRs, this supports creating a release using the commits from the branch (rather than the merge commit) | ||
ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
|
||
# This allows executing the action's code in the next step rather than a specific tag | ||
- uses: './.github/actions/use-local-dockerfile' | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Create a staging release | ||
uses: ./ | ||
env: | ||
# If you want this step to be mocked you can uncomment this variable | ||
# MOCK: true | ||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||
SENTRY_LOG_LEVEL: debug | ||
with: | ||
ignore_missing: true | ||
- name: Create a staging release | ||
uses: ./ | ||
env: | ||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||
SENTRY_LOG_LEVEL: debug | ||
with: | ||
ignore_missing: true | ||
|
||
mock-release: # Make sure that the action works on a clean machine without building Docker | ||
name: "Build image & mock a release" | ||
runs-on: ubuntu-latest | ||
mock-release: | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
runs-on: ${{ matrix.os }} | ||
name: Mock a release | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: './.github/actions/use-local-dockerfile' | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Mock creating a Sentry release | ||
uses: ./ | ||
env: | ||
MOCK: true | ||
with: | ||
environment: production | ||
- name: Mock creating a Sentry release | ||
uses: ./ | ||
env: | ||
MOCK: true | ||
with: | ||
environment: production | ||
|
||
mock-release-working-directory: | ||
name: "Build image & mock a release in a different working directory" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
runs-on: ${{ matrix.os }} | ||
name: Mock a release in a different working directory | ||
steps: | ||
- name: Checkout directory we'll be running from | ||
uses: actions/checkout@v3 | ||
with: | ||
path: main/ | ||
|
||
- name: Checkout directory we'll be testing | ||
uses: actions/checkout@v3 | ||
with: | ||
path: test/ | ||
- name: Checkout directory we'll be running from | ||
uses: actions/checkout@v4 | ||
with: | ||
path: main/ | ||
|
||
- uses: './main/.github/actions/use-local-dockerfile' | ||
with: | ||
working_directory: main | ||
- name: Checkout directory we'll be testing | ||
uses: actions/checkout@v4 | ||
with: | ||
path: test/ | ||
|
||
- name: Mock creating a Sentry release in a different directory | ||
uses: ./main | ||
env: | ||
MOCK: true | ||
with: | ||
environment: production | ||
working_directory: ./test | ||
- name: Mock creating a Sentry release in a different directory | ||
uses: ./main | ||
env: | ||
MOCK: true | ||
with: | ||
environment: production | ||
working_directory: ../test |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Inspired by @action/checkout | ||
# | ||
# Compares the checked in `dist/index.js` with the PR's `dist/index.js` | ||
# On mismatch this action fails | ||
name: Verify dist | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- "**.md" | ||
pull_request: | ||
paths-ignore: | ||
- "**.md" | ||
|
||
jobs: | ||
check-dist: | ||
name: Verify dist/index.js file | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use volta | ||
uses: volta-cli/action@v4 | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Rebuild dist | ||
run: yarn build | ||
|
||
- name: Compare expected and actual dist | ||
run: | | ||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | ||
echo "Detected uncommitted changes after build. Did you forget to commit `dist/index.js`?" | ||
echo "Diff:" | ||
git diff | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need special handling for pre-releases here? this should not run for those I guess. Ideally we only run this if the version matches
^(\d+)\.(\d+)\.(\d+)$
, I suppose?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The action does not trigger on pre-releases, I figured we don't need extra tags for those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, if that is the case, then all good!