# This workflow handles GitHub releases and pre-releases.
# It builds the Plugin, adds an archive artifact to the
# release entry on GitHub and (in the case of a full release)
# pushes the release to the WP Plugin Directory SVN repo.
name: Release Handler
on:
release:
types: [published]
jobs:
build_plugin:
name: Build the Plugin for pre-release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: |
composer install --no-dev --optimize-autoloader --no-progress
- name: Build Plugin
composer run build
- name: Rename dist/ folder
mv dist/ footnotes/
create_archive:
name: Create an archive for the release and add it to GitHub
needs: build_plugin
- name: Create release archive
uses: montudor/action-zip@v0.1.0
with:
args: zip -X -r footnotes-${{ github.event.release.tag_name }}.zip footnotes
- name: Upload archive as artifact
uses: actions/upload-artifact@v2
name: footnotes-${{ github.event.release.tag_name }}
path: footnotes-${{ github.event.release.tag_name }}.zip
- name: Upload archive to release
uses: JasonEtco/upload-to-release@master
args: footnotes-${{ github.event.release.tag_name }}.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release_to_svn:
name: Push the release to the WordPress Plugin Directory repo.
if: "!github.event.release.prerelease"
needs: create_archive
- name: Deploy release to Wordpress.org
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: footnotes/branches/svn-test
ASSETS_DIR: assets