Skip to content

Conversation

35C4n0r
Copy link
Collaborator

@35C4n0r 35C4n0r commented Sep 28, 2025

Closes: #100

@35C4n0r 35C4n0r self-assigned this Sep 28, 2025
@35C4n0r
Copy link
Collaborator Author

35C4n0r commented Sep 28, 2025

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

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

Copy link
Member

@matifali matifali left a 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
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- 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"
Copy link
Member

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?

@matifali matifali requested a review from johnstcn September 29, 2025 12:01

- name: Read PR number
id: pr
run: echo "number=$(cat number)" >> $GITHUB_OUTPUT
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
run: echo "number=$(cat number)" >> $GITHUB_OUTPUT
run: echo "number=${number}" >> $GITHUB_OUTPUT

Also, where does number come from? Should this be pr-number?

Copy link
Collaborator Author

@35C4n0r 35C4n0r Sep 29, 2025

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)

Comment on lines +46 to +56
# 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
Copy link
Member

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

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.

Copy link
Collaborator Author

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

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?

Copy link
Collaborator Author

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.

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.

CI: Create a release for PRs
3 participants