v0.0.6 #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build on Release | |
on: | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install PNPM | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 7 | |
run_install: false | |
- name: Get PNPM store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Setup PNPM cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build dependencies | |
run: pnpm build | |
# - name: Archive build files | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: build-artifacts | |
# path: dist | |
- name: Download release asset | |
run: wget -O archive.zip https://github.com/AlexanderGW/wpseoai/archive/${{ github.ref }}.zip | |
- name: Unzip archive | |
run: unzip archive.zip -d ./archive-output | |
- name: Create plugin directory | |
run: mkdir ai-seo-wp | |
- name: Add dist and archive assets to plugin directory | |
run: cp -R dist ./ai-seo-wp/ && cp -R ./archive-output/*/* ./ai-seo-wp/ | |
- name: Zip plugin directory | |
run: zip -r ai-seo-wp.zip ./ai-seo-wp | |
- name: Get Current Release | |
id: get_current_release | |
uses: joutvhu/get-release@v1 | |
with: | |
debug: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload plugin archive | |
uses: actions/upload-release-asset@v1.0.2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_current_release.outputs.upload_url }} | |
asset_path: ./ai-seo-wp.zip | |
asset_name: ai-seo-wp.zip | |
asset_content_type: application/zip |