diff --git a/.github/workflows/deploy-on-publishing-a-new-release-and-attach-a-zip-file-to-the-release.yml b/.github/workflows/deploy-on-publishing-a-new-release-and-attach-a-zip-file-to-the-release.yml new file mode 100644 index 0000000..d91f1ba --- /dev/null +++ b/.github/workflows/deploy-on-publishing-a-new-release-and-attach-a-zip-file-to-the-release.yml @@ -0,0 +1,60 @@ +name: Deploy to WordPress.org Repository + +on: + release: + types: [released] + +# A list of jobs involved in this workflow. +jobs: + deploy_to_wp_repository: + name: Deploy to WP.org + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build + run: | + npm install + npm run build + - name: WordPress Plugin Deploy + + id: gattai-deploy + + uses: 10up/action-wordpress-plugin-deploy@stable + + with: + generate-zip: true + dry-run: false + + # Steps can also set environment variables which can be configured in the Github settings for the + # repository. Here, we are using action secrets SVN_USERNAME, SVN_PASSWORD, and PLUGIN_SLUG which + # authenticate with WordPress and lets the action deploy our plugin to the repository. + # + # To learn more about setting and using secrets with Github Actions, check out: https://docs.github.com/en/actions/security-guides/encrypted-secrets?tool=webui#about-encrypted-secrets + env: + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + + # After the deploy, we also want to create a zip and upload it to the release on Github. We don't want + # users to have to go to the repository to find our plugin :). + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + # Note, this is an exception to action secrets: GH_TOKEN is always available and provides access to + # the current repository this action runs in. + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + with: + # Get the URL for uploading assets to the current release. + upload_url: ${{ github.event.release.upload_url }} + + # Provide the path to the file generated in the previous step using the output. + asset_path: ${{ steps.deploy.outputs.zip-path }} + + # Provide what the file should be named when attached to the release (plugin-name.zip) + asset_name: ${{ github.event.repository.name }}.zip + + # Provide the file type. + asset_content_type: application/zip