From 35f77568b92339c19ab98c118614b284919c4cd8 Mon Sep 17 00:00:00 2001 From: Burhan Nasir Date: Thu, 16 Jan 2025 11:57:21 +0500 Subject: [PATCH] Update readme --- .github/workflows/build-and-tag.yml | 49 +++++++++++++++++++ .../workflows/push-asset-readme-update.yml | 5 +- .github/workflows/push-deploy.yml | 25 +++++++--- CONTRIBUTING.md | 6 ++- 4 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/build-and-tag.yml diff --git a/.github/workflows/build-and-tag.yml b/.github/workflows/build-and-tag.yml new file mode 100644 index 00000000..0c4494fc --- /dev/null +++ b/.github/workflows/build-and-tag.yml @@ -0,0 +1,49 @@ +name: Build and Tag +on: + push: + branches: + - 'master' + +jobs: + wordpress: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set PHP version + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + extensions: :php-psr + coverage: none + + - name: composer install + run: composer install + + - name: install node v20 + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Build + run: | + npm ci + npm run build + + - name: Setup + run: 'echo "VERSION=$(grep -Po ''\"version\": \"[0-9\\.]+\"'' package.json | grep -Po ''[0-9\\.]+'')" >> $GITHUB_ENV' + + - name: Tag + run: | + echo "Releasing version $VERSION ..." + git config user.name github-actions + git config user.email github-actions@github.com + git checkout -b "release-$VERSION" + git add -f dist/* + git commit --no-verify -m "Release $VERSION" + git tag "$VERSION" + git push --tags + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/push-asset-readme-update.yml b/.github/workflows/push-asset-readme-update.yml index 7efb6913..5fae21f6 100644 --- a/.github/workflows/push-asset-readme-update.yml +++ b/.github/workflows/push-asset-readme-update.yml @@ -8,9 +8,10 @@ jobs: name: Push to master runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v4 - name: WordPress.org plugin asset/readme update - uses: 10up/action-wordpress-plugin-asset-update@master + uses: 10up/action-wordpress-plugin-asset-update@stable env: SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SLUG: brightcove-video-connect diff --git a/.github/workflows/push-deploy.yml b/.github/workflows/push-deploy.yml index d4c496ed..ad9896e9 100644 --- a/.github/workflows/push-deploy.yml +++ b/.github/workflows/push-deploy.yml @@ -1,16 +1,25 @@ -name: Deploy to WordPress.org +name: Publish New Release + +env: + SLUG: "brightcove-video-connect" + on: - push: - tags: - - "*" + release: + types: [published] + jobs: tag: - name: New tag + name: New release runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - name: Checkout code + uses: actions/checkout@v4 + - name: WordPress Plugin Deploy - uses: 10up/action-wordpress-plugin-deploy@master + if: "! github.event.release.prerelease" + id: deploy + uses: 10up/action-wordpress-plugin-deploy@stable env: - SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + SLUG: ${{ env.SLUG }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7cd33a7a..234432f9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,11 @@ The `develop` branch is the development branch which means it contains the next 1. Commit your changes and open a PR to `develop`. 1. Once changes are merged, open a PR from `develop` to `master`. 1. Test: Once changes are merged, checkout the `master` branch locally and test for functionality. -1. Release: Once merged, draft a [new release](https://github.com/10up/brightcove-video-connect/releases/new) naming the release with the new version number, creating a new label `X.Y.Z`, and selecting as target `master`. Paste the release changelog from `CHANGELOG.md` into the body of the release and include a link to the closed issues on the [milestone](https://github.com/10up/brightcove-video-connect/#?closed=1). +1. [Check the _Build and Tag_ action](https://github.com/10up/brightcove-video-connect/actions/workflows/build-and-tag.yml): a new tag named with the version number should've been created. It should contain all the built assets. +1. Release: Create a [new release](https://github.com/10up/brightcove-video-connect/releases/new): + * **Tag**: The tag created in the previous step + * **Release title**: `Version X.Y.Z` + * **Description**: Release changelog from `CHANGELOG.md` + `See: https://github.com/10up/brightcove-video-connect/milestone/#?closed=1` 1. SVN: Wait for the [GitHub Action](https://github.com/10up/brightcove-video-connect/actions/workflows/push-deploy.yml) to finish deploying to the WordPress.org repository. If all goes well, users with SVN commit access for that plugin will receive an emailed diff of changes. 1. Check WordPress.org: Ensure that the changes are live on https://wordpress.org/plugins/brightcove-video-connect/. This may take a few minutes. 1. Close milestone: Edit the [milestone](https://github.com/10up/brightcove-video-connect/milestone/#) with release date (in the `Due date (optional)` field) and link to GitHub release (in the `Description` field), then close the milestone.