-
Notifications
You must be signed in to change notification settings - Fork 79
feat: PR preview build release #101
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
base: main
Are you sure you want to change the base?
Conversation
Depends on: #102 |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
RELEASE_TAG: 'agentapi_${{ github.event.pull_request.number }}' | ||
|
||
run: gh release upload "$RELEASE_TAG" "$GITHUB_WORKSPACE"/out/* --clobber |
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.
Will this be a draft release? Also can we make this release not latest
.
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 don't think we are setting it as latest
in this workflow. Even in normal releases, we set the latest manually.
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.
We can test it out once #102 is reviewed and merged.
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.
LGTM. We should eventually merge this into a single release workflow that we can run conditionally on PRs too.
make gen | ||
./check_unstaged.sh | ||
- name: Build and Upload |
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.
- name: Build and Upload | |
- name: Build |
"linux arm64 agentapi-linux-arm64" | ||
"darwin amd64 agentapi-darwin-amd64" | ||
"darwin arm64 agentapi-darwin-arm64" | ||
"windows amd64 agentapi-windows-amd64.exe" |
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.
do we not build for arm64 windows?
|
||
- name: Read PR number | ||
id: pr | ||
run: echo "number=$(cat number)" >> $GITHUB_OUTPUT |
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.
run: echo "number=$(cat number)" >> $GITHUB_OUTPUT | |
run: echo "number=${number}" >> $GITHUB_OUTPUT |
Also, where does number
come from? Should this be pr-number
?
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.
@johnstcn the number comes from the downloaded artifact (that is uploaded by pr-preview-build
)
# Check if release exists | ||
if gh release view "$RELEASE_TAG" &>/dev/null; then | ||
echo "Updating release $RELEASE_TAG" | ||
gh release upload "$RELEASE_TAG" "$GITHUB_WORKSPACE"/out/* --clobber | ||
else | ||
echo "Creating release $RELEASE_TAG" | ||
gh release create "$RELEASE_TAG" "$GITHUB_WORKSPACE"/out/* \ | ||
--title "$RELEASE_TAG" \ | ||
--notes "Preview release for PR #${PR_NUMBER}" \ | ||
--draft --latest=false | ||
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.
We should validate the release tag before performing any actions e.g. it should start with preview-
or similar.
if gh release view "$RELEASE_TAG" &>/dev/null; then | ||
echo "Updating release $RELEASE_TAG" | ||
gh release upload "$RELEASE_TAG" "$GITHUB_WORKSPACE"/out/* --clobber | ||
else |
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.
You can just exit 0
here if there's nothing else to do, then you don't need the else
.
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 else contains the logic for the first release
echo "Creating release $RELEASE_TAG"
gh release create "$RELEASE_TAG" "$GITHUB_WORKSPACE"/out/* \
--title "$RELEASE_TAG" \
--notes "Preview release for PR #${PR_NUMBER}" \
--draft --latest=false
- name: Upload PR number | ||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 | ||
with: | ||
name: pr-number |
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.
Can't you use github.event.pull_request.number
here?
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.
No, in the pr-preview-release
until i don't download this artifact I won't be knowing about the pr number that triggered pr-preview-build
.
dbb3d54
to
c01d334
Compare
Closes: #100