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

Add script to update version #405

Merged
merged 21 commits into from
Aug 4, 2022

Conversation

andrew-fleming
Copy link
Collaborator

@andrew-fleming andrew-fleming commented Jul 24, 2022

Fixes #402.

This PR proposes to add a new job to the release workflow which invokes a script that updates all the SPDX identifiers in the src directory as well as the version in antora.yml (forthcoming). Some things to note:

  • this PR proposes for the version bump to be the first job prior to test
    • in the unlikely event that an unexpected behavior occurs that breaks the contracts, the tests will fail
    • for all other push events, the version job is skipped
  • the job commits directly to the protected branch main; therefore, a Personal Access Token should be used (otherwise the commit will be rejected)
  • no additional steps are required when pushing a release

@andrew-fleming
Copy link
Collaborator Author

For reference, this is the error without the PAT in the version job on the protected branch:

INPUT_PUSH_OPTIONS: 
remote: error: GH006: Protected branch update failed for refs/heads/main.        
remote: error: At least 1 approving review is required by reviewers with write access.        
To https://github.com/andrew-fleming/ci-test
 ! [remote rejected] main -> main (protected branch hook declined)
error: failed to push some refs to 'https://github.com/andrew-fleming/ci-test'

@martriay martriay marked this pull request as ready for review August 3, 2022 19:32
Copy link
Contributor

@martriay martriay left a comment

Choose a reason for hiding this comment

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

Great addition! I left some suggestions and comments.

.github/workflows/python-app.yml Outdated Show resolved Hide resolved
.github/workflows/python-app.yml Outdated Show resolved Hide resolved
RELEASING.md Outdated Show resolved Hide resolved
RELEASING.md Outdated Show resolved Hide resolved
scripts/update_version.py Show resolved Hide resolved
Copy link
Contributor

@martriay martriay left a comment

Choose a reason for hiding this comment

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

fixed some issues with my previous suggestion

RELEASING.md Outdated Show resolved Hide resolved
- name: Update version
run: python scripts/update_version.py ${{ env.RELEASE_VERSION }}
- name: Auto-commit changes
uses: stefanzweifel/git-auto-commit-action@49620cd3ed21ee620a48530e81dba0d139c9cb80
Copy link
Contributor

Choose a reason for hiding this comment

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

why the specific hash?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To mitigate risk. I think it's a safer play since we're using a third-party action here

Copy link
Contributor

Choose a reason for hiding this comment

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

do you know if devs can overwrite a version name? in any case the commit hash it's more certain

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed on the certainty^ And yes, I believe devs can replace the tag in git

Copy link
Contributor

@martriay martriay left a comment

Choose a reason for hiding this comment

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

Looking good! Left some comments

RELEASING.md Outdated
Comment on lines 15 to 18
> Note that the CI automatically:

- Updates the SPDX identifiers and antora.yml versions with the pushed tag
- Creates a release branch and adds a tag to it. This can be useful if we need to push a hot fix on top of an existing release in the case of a bug.
Copy link
Contributor

Choose a reason for hiding this comment

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

This formatting is kindof broken
image

RELEASING.md Outdated
```

(4) Create a release branch and add a tag to it. This branch can be useful if we need to push a hot fix on top of an existing release in the case of a bug.
(2) Create a tag for the release.
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems a bit isolated. Should we contextualize the tag? e.g. checkout the branch to be released

RELEASING.md Outdated Show resolved Hide resolved
Copy link
Contributor

@martriay martriay left a comment

Choose a reason for hiding this comment

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

Ready to me!

@martriay martriay merged commit 995e5b1 into OpenZeppelin:main Aug 4, 2022
@andrew-fleming andrew-fleming deleted the update-version branch August 5, 2022 00:15
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.

Automate version bump in CI
3 participants