From 1a6973c43e59cadee922c74b735da83d8f63386f Mon Sep 17 00:00:00 2001 From: Chris Wiegman Date: Wed, 26 Jun 2024 09:30:56 -0500 Subject: [PATCH 1/2] Move schema generation into release step --- .github/workflows/release.yml | 36 +++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8dbabe26..a2269554 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,11 +6,24 @@ on: - main jobs: + call-workflow-test-plugin: uses: ./.github/workflows/test-plugin.yml + release: + services: + mariadb: + image: mariadb:10.8.2 + ports: + - 3306:3306 + env: + MYSQL_ROOT_PASSWORD: root + # Ensure docker waits for mariadb to start + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + name: Release runs-on: ubuntu-22.04 + steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -32,11 +45,10 @@ jobs: version: npm run version title: "Release Plugin" commit: "Release Plugin" - env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Upload release artifact + - name: Upload plugin zip file if: steps.changesets.outputs.published == 'true' uses: svenstaro/upload-release-action@v2 with: @@ -45,3 +57,23 @@ jobs: asset_name: wp-graphql-content-blocks.zip tag: ${{ format('v{0}', fromJSON(steps.changesets.outputs.publishedPackages)[0].version) }} overwrite: true + + - name: Setup WordPress to generate static schema + if: steps.changesets.outputs.published == 'true' + uses: ./.github/actions/setup-wordpress + + - name: Generate the static schema + if: steps.changesets.outputs.published == 'true' + run: | + cd /tmp/wordpress + # Output: /tmp/schema.graphql + wp graphql generate-static-schema + + - name: Upload schema as release artifact + if: steps.changesets.outputs.published == 'true' + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ format('v{0}', fromJSON(steps.changesets.outputs.publishedPackages)[0].version)}} + files: /tmp/schema.graphql + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file From a1fbd3c567c2b8178925a1c8bd2eecdf6b91e13a Mon Sep 17 00:00:00 2001 From: Chris Wiegman Date: Wed, 26 Jun 2024 09:32:19 -0500 Subject: [PATCH 2/2] Remove stand-alone schema upload action --- .github/workflows/upload-schema-artifact.yml | 39 -------------------- 1 file changed, 39 deletions(-) delete mode 100644 .github/workflows/upload-schema-artifact.yml diff --git a/.github/workflows/upload-schema-artifact.yml b/.github/workflows/upload-schema-artifact.yml deleted file mode 100644 index 550e4dca..00000000 --- a/.github/workflows/upload-schema-artifact.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Upload Schema Artifact - -on: - release: - types: [ published ] - -jobs: - run: - runs-on: ubuntu-22.04 - name: Generate and Upload WPGraphQL Schema Artifact - services: - mariadb: - image: mariadb:10.8.2 - ports: - - 3306:3306 - env: - MYSQL_ROOT_PASSWORD: root - # Ensure docker waits for mariadb to start - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup WordPress - uses: ./.github/actions/setup-wordpress - - - name: Generate the Static Schema - run: | - cd /tmp/wordpress - # Output: /tmp/schema.graphql - wp graphql generate-static-schema - - - name: Upload schema as release artifact - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ format('v{0}',github.ref_name)}} - files: /tmp/schema.graphql - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}