From 341c6cab0c43a4f5259d4cecc10f0072ab1fccfe Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 5 Nov 2020 19:25:24 +0100 Subject: [PATCH 1/3] Add GH Action to build plugin --- .github/workflows/build-plugin-zip.yml | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/build-plugin-zip.yml diff --git a/.github/workflows/build-plugin-zip.yml b/.github/workflows/build-plugin-zip.yml new file mode 100644 index 00000000000000..7fae5f16ff1884 --- /dev/null +++ b/.github/workflows/build-plugin-zip.yml @@ -0,0 +1,64 @@ +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +name: Build Gutenberg and upload to Draft Release + +jobs: + build: + name: Upload Release Asset + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@master + + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + + - name: Build Gutenberg plugin ZIP file + run: ./bin/build-plugin-zip.sh + env: + NO_CHECKS: 'true' + + - name: Set Release Version + id: get_release_version + run: echo ::set-output name=version::$(echo $GITHUB_REF | cut -d / -f 3 | sed s/^v// | sed 's/-rc./ RC/' ) + + - name: Create Release + id: create_release + uses: actions/create-release@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ steps.get_release_version.outputs.version }} + draft: true + prerelease: ${{ contains(github.ref, 'rc') }} + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./gutenberg.zip + asset_name: gutenberg.zip + asset_content_type: application/zip From f8b02e0cb5b999ab94e06f43e15cbd121bf7a0f7 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 5 Nov 2020 19:33:08 +0100 Subject: [PATCH 2/3] Run on every PR, upload artifact rather than creating release --- .github/workflows/build-plugin-zip.yml | 41 ++++++++------------------ 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build-plugin-zip.yml b/.github/workflows/build-plugin-zip.yml index 7fae5f16ff1884..ff16019098c16b 100644 --- a/.github/workflows/build-plugin-zip.yml +++ b/.github/workflows/build-plugin-zip.yml @@ -1,10 +1,13 @@ +name: Build Gutenberg Plugin Zip + on: + pull_request: + paths-ignore: + - '**.md' push: - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - -name: Build Gutenberg and upload to Draft Release + branches: [master] + paths-ignore: + - '**.md' jobs: build: @@ -37,28 +40,8 @@ jobs: env: NO_CHECKS: 'true' - - name: Set Release Version - id: get_release_version - run: echo ::set-output name=version::$(echo $GITHUB_REF | cut -d / -f 3 | sed s/^v// | sed 's/-rc./ RC/' ) - - - name: Create Release - id: create_release - uses: actions/create-release@v1.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ steps.get_release_version.outputs.version }} - draft: true - prerelease: ${{ contains(github.ref, 'rc') }} - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload artifact + uses: actions/upload-artifact@v2 with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./gutenberg.zip - asset_name: gutenberg.zip - asset_content_type: application/zip + name: gutenberg-plugin + path: ./gutenberg.zip \ No newline at end of file From 7265734e4e778e4a2c86782216c0c3c7bfe89da9 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 5 Nov 2020 20:00:53 +0100 Subject: [PATCH 3/3] Change build job name --- .github/workflows/build-plugin-zip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-plugin-zip.yml b/.github/workflows/build-plugin-zip.yml index ff16019098c16b..6e7f3a3f4439d9 100644 --- a/.github/workflows/build-plugin-zip.yml +++ b/.github/workflows/build-plugin-zip.yml @@ -11,7 +11,7 @@ on: jobs: build: - name: Upload Release Asset + name: Build Release Artifact runs-on: ubuntu-latest steps: - name: Checkout code