From 3b1ad964ebf0e59510e247fd7f9638d1883c77f6 Mon Sep 17 00:00:00 2001 From: pjv Date: Fri, 28 Apr 2023 10:20:12 -0500 Subject: [PATCH] new github workflow to push to wordpress SVN repo --- .github/workflows/create-release.yml | 38 ---------------------------- .github/workflows/deploy.yml | 33 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/create-release.yml create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml deleted file mode 100644 index 24f2c44..0000000 --- a/.github/workflows/create-release.yml +++ /dev/null @@ -1,38 +0,0 @@ -# GitHub Action: whenever creating a new release of the source code, -# also create a release of the installable plugin. -# Steps to execute: -# - Checkout the source code -# - Run "composer install" to download all dependencies under vendor/ -# - Create a .zip file, excluding: -# - All hidden files (.git, .gitignore, etc) -# - All development files, ending in .dist -# - All composer files <= after installing dependencies, no need for them anymore -# - Markdown files concerning development -# - Folder build/ <= created only to store the .zip file -# - Upload the .zip file as an artifact to the action (this step is possibly optional) -# - Upload the .zip file as a release, for download -name: Generate Installable Plugin, and Upload as Release Asset -on: - release: - types: [published] -jobs: - build: - name: Upload Release Asset - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Build project - run: | - composer install --no-dev --optimize-autoloader - mkdir build - - name: Create artifact - uses: montudor/action-zip@v0.1.0 - with: - args: zip -X -r build/nostrtium.zip . -x *.git* node_modules/\* .* "*/\.*" CODE_OF_CONDUCT.md CONTRIBUTING.md ISSUE_TEMPLATE.md PULL_REQUEST_TEMPLATE.md README.md *.dist composer.* build** - - name: Upload to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/nostrtium.zip - asset_name: nostrtium.zip \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..378ecf1 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,33 @@ +# deploy to wordpress and also create a release on github +name: Deploy to WordPress.org +on: + release: + types: [published] +jobs: + tag: + name: New release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build + run: | + composer install --no-dev --optimize-autoloader + - name: WordPress Plugin Deploy + id: deploy + uses: 10up/action-wordpress-plugin-deploy@stable + with: + generate-zip: true + dry-run: true + env: + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ steps.deploy.outputs.zip-path }} + asset_name: ${{ github.event.repository.name }}.zip + asset_content_type: application/zip \ No newline at end of file