From 61960e657bc9b7716a2c6ade3aa458adc9502bcd Mon Sep 17 00:00:00 2001 From: Rich Tabor Date: Sun, 7 Jul 2024 20:04:42 -0400 Subject: [PATCH] Create create-release.yml (#5) * Create create-release.yml * Update create-release.yml * Update create-release.yml * Update package.json --- .github/workflows/create-release.yml | 49 ++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/create-release.yml diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..2d83d34 --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,49 @@ +name: Create Release + +on: + push: + tags: + - '*' + +permissions: + contents: write + +jobs: + create-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20.11.0' # Specify the Node.js version you need + + - name: Install dependencies + run: npm install + + - name: Build plugin zip + run: npm run plugin-zip + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dark-mode-toggle-block.zip + asset_name: dark-mode-toggle-block.zip + asset_content_type: application/zip diff --git a/package.json b/package.json index e9df702..521ad0e 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "lint:js": "wp-scripts lint-js", "lint:js-fix": "wp-scripts lint-js --fix", "packages-update": "wp-scripts packages-update", - "plugin-zip": "wp-scripts plugin-zip", + "plugin-zip": "wp-scripts build && wp-scripts plugin-zip", "start": "wp-scripts start", "dev": "wp-scripts start" },