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: add release workflow #360

Merged
merged 6 commits into from
Jan 16, 2023
Merged

chore: add release workflow #360

merged 6 commits into from
Jan 16, 2023

Conversation

shoelsch
Copy link
Contributor

Adds release workflow that (1) creates a GitHub release and (2) publishes built artifacts to PyPI

Release Workflow

  1. Checkout master locally and cut a new branch
  2. Run poetry version <rule> to version bump (e.g., poetry version patch)
  3. Commit changes and push to remote branch
  4. Ensure all quality check workflows pass
  5. Explicitly tag PR with release label
  6. Merge to mainline

At this point, a release workflow should be triggered because:

  • The PR is closed, targeting master, and merged
  • pyproject.toml has been detected as modified
  • The PR had a release label

The workflow will then proceed to build the artifacts, create a GitHub release with release notes and uploaded artifacts, and publish to PyPI.

Example Workflow run: https://github.com/shoelsch/langchain/actions/runs/3711037455/jobs/6291076898
Example Releases: https://github.com/shoelsch/langchain/releases

--

Note, this workflow is looking for the PYPI_API_TOKEN secret, so that will need to be uploaded to the repository secrets. I tested uploading as far as hitting a permissions issue due to project ownership in Test PyPI.

@hwchase17
Copy link
Contributor

this looks solid! im going to wait to merge it in until next week (i have a bit limited availability this weekend, so i dont want to risk anything going wrong)

@hwchase17 hwchase17 merged commit a599935 into langchain-ai:master Jan 16, 2023
obi1kenobi pushed a commit that referenced this pull request Aug 21, 2023
I have discovered a bug located within `.github/workflows/_release.yml`
which is the primary cause of continuous integration (CI) errors. The
problem can be solved; therefore, I have constructed a PR to address the
issue.

## The Issue

Access the following link to view the exact errors: [Langhain Release
Workflow](https://github.com/langchain-ai/langchain/actions/workflows/langchain_release.yml)

The instances of these errors take place for **each PR** that updates
`pyproject.toml`, excluding those specifically associated with bumping
PRs.

See below for the specific error message:

```
Error: Error 422: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}
```

An image of the error can be viewed here:

![Image](https://github.com/langchain-ai/langchain/assets/13769670/13125f73-9b53-49b7-a83e-653bb01a1da1)

The `_release.yml` document contains the following if-condition:

```yaml
    if: |
        ${{ github.event.pull_request.merged == true }}
        && ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
```

## The Root Cause

The above job constantly runs as the `if-condition` is always identified
as `true`.

## The Logic

The `if-condition` can be defined as `if: ${{ b1 }} && ${{ b2 }}`, where
`b1` and `b2` are boolean values. However, in terms of condition
evaluation with GitHub Actions, `${{ false }}` is identified as a string
value, thereby rendering it as truthy as per the [official
documentation](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif).

I have run some tests regarding this behavior within my forked
repository. You can consult my [debug
PR](zawakin#1) for reference.

Here is the result of the tests:

|If-Condition|Outcome|
|:--:|:--:|
|`if: true && ${{ false }}`|Execution|
|`if: ${{ false }}` |Skipped|
|`if: true && false` |Skipped|
|`if: false`|Skipped|
|`if: ${{ true && false }}` |Skipped|

In view of the first and second results, we can infer that `${{ false
}}` can only be interpreted as `true` for conditions composed of some
expressions.
It is consistent that the condition of `if: ${{ inputs.working-directory
== 'libs/langchain' }}` works.

It is surprised to be skipped for the second case but it seems the spec
of GitHub Actions 😓

Anyway, the PR would fix these errors, I believe 👍 

Could you review this? @hwchase17 or @shoelsch , who is the author of
[PR](#360).
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.

2 participants