-
Notifications
You must be signed in to change notification settings - Fork 251
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
Add automatic dependency updating workflow to github actions #2168
Closed
Closed
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b50da23
Add github actions workflow to automatically update the android and c…
Cawllec 0a3b88e
Merge pull request #1 from Cawllec/bumpsnag-deps
Cawllec aa47e09
Ensure the script is executable
Cawllec 2ba9cff
Ensure script works properly?
Cawllec 7bc5e9e
Fix up some scripts
Cawllec a736eef
Syntax
Cawllec 74eeec6
Reduce noise
Cawllec 5957df6
Ensure github token is available
Cawllec 57f62c2
Use correct env vars
Cawllec 3560d07
Try workflow with bundle install in different position
Cawllec 5d65a8b
Try again
Cawllec 93aea09
Rely on bumpsnag to sort commit contents
Cawllec 5e6f4f6
Use an env var to declare the reviewer
Cawllec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: update-dependencies | ||
|
||
on: | ||
repository_dispatch: | ||
types: [update-dependency] | ||
workflow_dispatch: | ||
inputs: | ||
target_submodule: | ||
description: 'Submodule to update' | ||
required: true | ||
type: string | ||
target_version: | ||
description: 'Version of the submodule to update to' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
update-dependencies: | ||
runs-on: macos-latest | ||
env: | ||
SUBMODULE: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.target_submodule || inputs.target_submodule }} | ||
VERSION: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.target_version || inputs.target_version }} | ||
BUNDLE_GITHUB__COM: ${{ secrets.BUNDLE_ACCESS_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: next | ||
|
||
- run: | | ||
git config --global user.name 'Bumpsnag bot' | ||
git config --global user.email '' | ||
|
||
- run: git fetch --prune --unshallow | ||
|
||
- name: Install ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.7 | ||
|
||
- name: Install dependencies | ||
run: bundle install | ||
|
||
- name: Update references locally | ||
run: TARGET_SUBMODULE=$SUBMODULE TARGET_VERSION=$VERSION ./scripts/update-dependencies.rb | ||
|
||
- name: Commit and push changes | ||
run: bundle exec bumpsnag commit-update $SUBMODULE $VERSION | ||
|
||
- name: List current branch name | ||
id: current-branch | ||
run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT | ||
|
||
- name: Create pull request | ||
if: ${{ steps.current-branch.outputs.branch != 'next'}} | ||
run: > | ||
gh pr create -B next | ||
-H bumpsnag-$SUBMODULE-$VERSION | ||
--title "Update $SUBMODULE to version $VERSION" | ||
--body 'Created by bumpsnag' | ||
--reviewer gingerbenw | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'cocoapods', '~> 1.14.3' | ||
|
||
# Only install bumpsnag if we're using Github actions | ||
unless ENV['GITHUB_ACTIONS'].nil? | ||
gem 'bumpsnag', git: 'https://github.com/bugsnag/platforms-bumpsnag', branch: 'main' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#! /usr/bin/env ruby | ||
|
||
target_submodule = ENV['TARGET_SUBMODULE'] | ||
target_version = ENV['TARGET_VERSION'] | ||
|
||
if target_submodule.nil? || target_version.nil? | ||
raise 'Submodule or version targets not provided, exiting' | ||
exit(1) | ||
end | ||
|
||
pp "Attempting upgrade of #{target_submodule} to #{target_version}" | ||
|
||
if target_submodule.eql?('bugsnag-android') | ||
version = /(\d+\.\d+\.\d+)/.match(target_version)[1] | ||
`packages/react-native/update-android.sh --version #{version}` | ||
elsif target_submodule.eql?('bugsnag-cocoa') | ||
`packages/react-native/update-ios.sh --version #{target_version}` | ||
else | ||
raise "Submodule #{target_submodule} not supported, exiting" | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is this better to be an environment variable?