From c329eb302f3fa48b25a3674450c7c78abe3490b6 Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Mon, 22 Apr 2024 12:35:32 -0700 Subject: [PATCH] Add release automation Signed-off-by: Sayali Gaikawad --- .github/workflows/release.yml | 35 +++++++++++++++++++++++++++++++++++ CHANGELOG.md | 1 + 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..e01d86e4 --- /dev/null +++ b/.github/workflows/release.yml @@ -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"}}' + + - name: Release on GitHub + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true diff --git a/CHANGELOG.md b/CHANGELOG.md index d1c66a19..b67c008a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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