Skip to content

Merge pull request #100 from wp-graphql/issue-93-automate-github-release #19

Merge pull request #100 from wp-graphql/issue-93-automate-github-release

Merge pull request #100 from wp-graphql/issue-93-automate-github-release #19

name: Release Plugin
on:
push:
branches:
- main
tags:
- "v*"
jobs:
build-and-release:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Install Dependencies using npm ci
run: npm ci
- name: Create Release Pull Request or Create GitHub Release
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: npm run release
version: npm run version
title: "Release Plugin"
commit: "Release Plugin"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release artifact
if: steps.changesets.outputs.published == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "@wpgraphql/ide.zip"
asset_name: wpgraphql-ide.zip
tag: ${{ format('v{0}', fromJSON(steps.changesets.outputs.publishedPackages)[0].version) }}
overwrite: true