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 release automation #183

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release to packagist

on:
push:
tags:
- "*"

jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
issues: write
steps:
- uses: actions/checkout@v3

- id: get_data
run: echo "approvers=$(cat .github/CODEOWNERS | grep @ | tr -d '* ' | sed 's/@/,/g' | sed 's/,//1')" >> $GITHUB_OUTPUT

- uses: trstringer/manual-approval@v1
with:
secret: ${{ github.TOKEN }}
approvers: ${{ steps.get_data.outputs.approvers }}
minimum-approvals: 2
issue-title: 'Release opensearch-PHP'
issue-body: "Please approve or deny the release of opensearch-PHP client on packagist. **TAG**: ${{ github.ref_name }} **COMMIT**: ${{ github.sha }}"
exclude-workflow-initiator-as-approver: true

- name: Release to Packagist
run: curl -XPOST -f -H 'content-type:application/json' 'https://packagist.org/api/update-package?username=opensearch&apiToken=${{secrets.PACKAGIST_PUBLISHING_API_TOKEN}}' -d'{"repository":{"url":"https://github.com/opensearch-project/opensearch-php"}}'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we maybe just set up it as a webhook on the GitHub Repository itself?

Here is an example of a project of mine
image

It's pretty valueable, when the branches are also keeped up to date on packagist.

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe other maintainer wanted to only publish based on tag opensearch-project/opensearch-build#3146 (comment)
@dblock @VachaShah @harshavamsi Asking for your input here

Copy link
Member

@dblock dblock Apr 22, 2024

Choose a reason for hiding this comment

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

@shyim Want to open a separate issue for this? I am concerned that there might be security implications of auto-running workflows on merge of arbitrary branches that have access to keys.


- name: Release on GitHub
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added code coverage reporting ([#100](https://github.com/opensearch-project/opensearch-php/pull/100))
- Added support for a custom signing service name for AWS SigV4 ([#117](https://github.com/opensearch-project/opensearch-php/pull/117))
- Added support for OpenSearch 2.12 and 2.13 ([#180](https://github.com/opensearch-project/opensearch-php/pull/180))
- Added release automation to publish to packagist ([#183](https://github.com/opensearch-project/opensearch-php/pull/183))

### Changed

Expand Down
2 changes: 2 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Repositories create consistent release labels, such as `v1.0.0`, `v1.1.0` and `v

The release process is standard across repositories in this org and is run by a release manager volunteering from amongst [MAINTAINERS](MAINTAINERS.md).

Push a tag to this repository aganist the right commit. This triggers [release.yml](.github/workflows/release.yml) workflow which is responsible to get approval from the maintainers in the form of comments on the GitHub issue, release the client to packagist using manual webhook and finally publishing a release on the GitHub.
Copy link
Member

Choose a reason for hiding this comment

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

on the GitHub -> on GitHub

we can fix another time


## Backporting

This project follows [semantic versioning](https://semver.org/spec/v2.0.0.html). Backwards-incompatible changes always result in a new major version and will __never__ be backported. Small improvements and features will be backported to a new minor version (e.g. `1.1`). Security fixes will be backported to a new patch version (e.g. `1.0.1`).
Expand Down
Loading