Skip to content
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

chore(action): Rework action to be a composite action #243

Merged
merged 15 commits into from
Feb 6, 2025

Conversation

andreiborza
Copy link
Member

  • Removed docker image and workflow around it
  • Externalizing @sentry/cli so it can be installed per-runner
  • Support versioning of actions publishing major, minor and patch tags allowing users to pin versions
  • Reduce action run time by 80% as a result

Closes: #185, #193, #233

- Removed docker image and workflow around it
- Externalizing `@sentry/cli` so it can be installed per-runner
- Support versioning of actions publishing major, minor and patch tags allowing
  users to pin versions
- Reduce action run time by 80% as a result

Closes: #185, #193, #233
@andreiborza andreiborza requested review from mydea and Lms24 February 5, 2025 11:43
@@ -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
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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!

- uses: './.github/actions/use-local-dockerfile'
- uses: actions/checkout@v3
with:
fetch-depth: 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this necessary? do we need all commits here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a recommendation we give when using the action, probably because of set-commits. I suppose for the tests we don't need to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Co-authored-by: Francesco Gringl-Novy <[email protected]>
action.yml Outdated

- name: Install Sentry CLI v2
shell: bash
run: yarn add @sentry/cli@2
Copy link
Member

@mydea mydea Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: For a follow up, let's allow to make this configurable as an input (optionally) so you can pick a specific version here!

m: Also, how does that work with caching & new cli versions? We should ensure that new v2 versions are used. Probably, we should cache yarn including the used sentry-cli version here? 🤔 and use npm view @sentry/cli version to get the latest v2 version here, somehow...?

Finally, instead of yarn add let's use yarn add @sentry/cli --no-lockfile --dev to avoid actually mutating the lockfile here, we do not care about this I'd say? that should also silence the warning for double installing this...?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.. I removed the caching again because it doesn't make sense when installing the cli on the ci and we can't possibly commit the lockfile back.

Replaced yarn add with yarn add --dev --no-lockfile @sentry/cli@2

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good and love the reduction in runtime!

Had a couple of questions but I think this is a great improvement!

Let's also make sure we document the new release flow properly so that future contributors know what to do. (if this is already done, even better; just didn't see anything in this PR)

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
Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The 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 v1 tag will be updated to point to the tag from the craft release e.g. v1.5.4

action.yml Outdated

- name: Install Sentry CLI v2
shell: bash
run: yarn add @sentry/cli@2
Copy link
Member

@Lms24 Lms24 Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: Have you thought about pinning the CLI version? Can we read it from dev dependencies? In the bundler plugins we pin it. I think it would be good to associate a specific release of the action with a specific CLI version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I debatted pinning the version but people rarely upgrade their github actions and I figured it would be good to at least receive patches for sentry-cli.

I changed this to ~2.4 and in a follow up we might want to have this configurable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point that this isn't necessarily the same situation. I'm a bit concerned that this then still doesn't give us consistent behaviour for one action version but we can still change this later on if we ever receive bug reports. No objections to going with ^2.4 or ~2.4 then

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

src/main.ts Outdated
const workingDirectory = options.getWorkingDirectory();
const currentWorkingDirectory = process.cwd();

if (workingDirectory !== null && workingDirectory.length > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: Can this just be if (workingDirectory) ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@andreiborza andreiborza merged commit 24fbab5 into master Feb 6, 2025
15 checks passed
@andreiborza andreiborza deleted the ab/composite-action branch February 6, 2025 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add macOS runner support
3 participants