releaser.sh to use gh to create PRs (#18379)

The changes were tested by releasing fleetd 1.24.0 to `edge`.
This commit is contained in:
Lucas Manuel Rodriguez
2024-04-17 18:21:45 -03:00
committed by GitHub
parent 420e2adb0f
commit 6fde96a984
2 changed files with 19 additions and 5 deletions
+6 -3
View File
@@ -39,6 +39,7 @@ Following is the checklist for all credentials and configuration needed to run t
- `aws` cli :`brew install awscli`.
- `fleetctl`: Either built from source or installed by npm.
- `tuf`: Download the release from https://github.com/theupdateframework/go-tuf/releases/download/v0.7.0/tuf_0.7.0_darwin_amd64.tar.gz and place the `tuf` executable in `/usr/local/bin/tuf`. You will need to make an exception in "Privacy & Security" because the executable is not signed.
- `gh`: `brew install gh`.
### 1Password
@@ -108,8 +109,11 @@ Private/Github Token/password
#### Github session
You need to log in to your Github account with your default browser.
It will be used to open your browser and allow you to create the PR needed to build artifacts (this can be improved later, see TODOs).
You need to log in to your Github account using the cli (`gh`).
```sh
gh auth login
```
It will be used to create a PR which is used to update the changelog and trigger the Github actions to build components.
## Samples
@@ -236,7 +240,6 @@ GIT_REPOSITORY_DIRECTORY=<SOME_DIRECTORY>
## TODOs to improve releaser.sh
- Create the pull requests automatically using `gh` or the Github API.
- Support releasing `nudge` and `swiftDialog`.
## Troubleshooting
+13 -2
View File
@@ -58,6 +58,7 @@ setup () {
cp -r "$KEYS_SOURCE_DIRECTORY" "$KEYS_DIRECTORY"
if ! aws sts get-caller-identity &> /dev/null; then
prompt "You need to login to AWS using the cli, press any key to continue..."
aws sso login
prompt "AWS SSO login was successful, press any key to continue..."
fi
@@ -67,6 +68,15 @@ setup () {
GITHUB_TOKEN=$(op read "op://$GITHUB_TOKEN_1PASSWORD_PATH")
fi
# We only need to be logged in to github when releasing to edge.
if [[ $ACTION == "release-to-edge" ]]; then
if ! gh auth status >/dev/null 2>&1; then
prompt "You need to login to Github using the cli, press any key to continue..."
gh auth login
prompt "Github login was successful, press any key to continue..."
fi
fi
# These need to be exported for use by `fleetctl updates` commands.
FLEET_TARGETS_PASSPHRASE=$(op read "op://$TARGETS_PASSPHRASE_1PASSWORD_PATH")
export FLEET_TARGETS_PASSPHRASE
@@ -148,8 +158,9 @@ release_fleetd_to_edge () {
git add .github/workflows/generate-desktop-targets.yml "$ORBIT_CHANGELOG"
git commit -m "Release fleetd $VERSION"
git push origin "$BRANCH_NAME"
open "https://github.com/fleetdm/fleet/pull/new/$BRANCH_NAME"
prompt "Press any key to continue after the PR is created..."
prompt "A PR will be created, press any key to continue..."
gh pr create -f -B main -t "Release fleetd $VERSION"
prompt "Press any key to continue after the PR is created and you have made all the necessary edits to it..."
prompt "A 'git tag' will be created to trigger a Github Action to build orbit, press any key to continue..."
git tag "$ORBIT_TAG"
git push origin "$ORBIT_TAG"