Skip to content

Commit

Permalink
Adjusting release.yml to generate POT file upon release
Browse files Browse the repository at this point in the history
  • Loading branch information
DevinWalker committed Dec 29, 2023
1 parent 5364310 commit 3693cf4
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 24 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/pre-release.yml

This file was deleted.

77 changes: 66 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,71 @@ name: Deploy to WordPress.org
on:
release:
types: [ released ]
worflow_dispatch:

jobs:
build:
uses: impress-org/givewp-github-actions/.github/workflows/wp-org-release.yml@master
with:
wp_org_slug: wp-rollback
zip_name: wp-rollback
text_domain: wp-rollback
install_composer_packages: false
secrets:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLACK_ANNOUNCEMENT_WEBHOOK:
tests:
uses: ./.github/workflows/wordpress.yml

release:
name: New release
runs-on: ubuntu-20.04
environment: live
needs: tests
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Install composer dependencies
uses: php-actions/composer@v5
with:
php_version: 7.4
dev: no

- uses: actions/setup-node@v2
with:
node-version: '12'

- name: Install npm dependencies & build for translation
run: |
npm install -g npm@7
npm ci
npm run dev
# In order to run this WordPress also needs to be installed
- name: Generate pot file
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
php -d xdebug.mode=off "$(which wp)" i18n make-pot ${{github.workspace}} ${{github.workspace}}/languages/wp-rollback.pot --exclude="$(cat .distignore | tr "\n" "," | sed 's/,$/ /' | tr " " "\n"),src/**/*.js,*.js.map,blocks/**/*.js"
- name: Build assets for production
run: npm run build

- name: WordPress Plugin Deploy
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
with:
generate-zip: true
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: wp-rollback

- 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: ${{github.workspace}}/wp-rollback.zip
asset_name: wp-rollback.zip
asset_content_type: application/zip
3 changes: 2 additions & 1 deletion wp-rollback.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ public function scripts( $hook ): void {
$script_asset['dependencies'],
$script_asset['version']
);
wp_set_script_translations( 'wp-rollback-plugin-block-editor', 'wp-rollback' );
// For i18n.
wp_set_script_translations( 'wp-rollback-plugin-admin-editor', 'wp-rollback', WP_ROLLBACK_PLUGIN_DIR . 'languages' );

// Localize the script with vars for JS.
wp_localize_script( 'wp-rollback-plugin-admin-editor', 'wprData', [
Expand Down

0 comments on commit 3693cf4

Please sign in to comment.