Skip to content

Prepare for translation #12

Prepare for translation

Prepare for translation #12

name: Prepare for translation
on:
push:
branches:
- 'pre-release'
workflow_dispatch:
inputs:
tmate_enabled:
type: boolean
description: 'Enable "tmate" for debugging'
required: false
default: false
jobs:
check:
name: Check the POT file and prepare for translation
env:
# ISSUE_ASSIGNEE: wocmultimedia
ISSUE_ASSIGNEE: andergmartins
# ISSUE_CC: "@wocmultimedia, @andergmartins, @stevejburge"
ISSUE_CC: "@andergmartins"
GH_TOKEN: ${{ github.token }}
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@master
- name: Setup tmate session for Debugging, if inputs.tmate_enabled is true
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.tmate_enabled }}
timeout-minutes: 10
- name: Prepare composer
run: |
$GITHUB_WORKSPACE/dev-workspace/run composer validate
$GITHUB_WORKSPACE/dev-workspace/run composer install
- name: Show version of tools inside the dev-workspace
run: |
$GITHUB_WORKSPACE/dev-workspace/run composer info:versions
# - name: Run POT file check against the main branch
# run: |
# OUTPUT=$($GITHUB_WORKSPACE/dev-workspace/run composer check:pot-diff-md)
# PLUGIN_VERSION=${{ steps.get-plugin-version.outputs.PLUGIN_VERSION }}
# echo "Checking for changes in POT file for version $PLUGIN_VERSION"
# echo "$OUTPUT"
# echo ""
# if [[ ! "$OUTPUT" =~ "No messages found" ]]; then
# # Check if issue already exists
# ISSUE_EXISTS=$(gh issue list --search "POT file has changes that need to be reviewed for version $PLUGIN_VERSION in:title is:open" --json number --jq 'length')
# if [ "$ISSUE_EXISTS" -eq 0 ]; then
# echo ""
# echo "No issue found, creating a new one"
# gh issue create \
# --title "POT file has changes that need to be reviewed for version $PLUGIN_VERSION" \
# --body "The POT file check detected changes between the main branch and the current branch.<br />Please review and update the PO files.<br /><br />CC: $ISSUE_CC<br /><br />Output of \`check:pot-diff\`:<br />$OUTPUT" \
# --label "translation" \
# --assignee "$ISSUE_ASSIGNEE"
# else
# ISSUE_NUMBER=$(gh issue list --search "POT file has changes that need to be reviewed for version $PLUGIN_VERSION in:title" --json number --jq '.[0].number')
# echo ""
# echo "Changes found"
# echo "Commenting on issue $ISSUE_NUMBER"
# gh issue comment $ISSUE_NUMBER --body "Additional changes detected in the repository for version $PLUGIN_VERSION. Please review the latest differences below.<br /><br />CC: $ISSUE_CC<br /><br />Latest output of \`check:pot-diff\`:<br />$OUTPUT"
# fi
# fi
- name: Get the current version number and store it in a variable
id: get-plugin-version
run: |
PLUGIN_VERSION=$($GITHUB_WORKSPACE/dev-workspace/run pversion)
echo "Current version: $PLUGIN_VERSION"
echo "PLUGIN_VERSION=$PLUGIN_VERSION" >> $GITHUB_OUTPUT
- name: Build the testing package and get its url for download
id: build-testing-package
run: |
$GITHUB_WORKSPACE/dev-workspace/run composer build
ZIPFILE_NAME=$($GITHUB_WORKSPACE/dev-workspace/run pzipfile)
echo "ZIPFILE_NAME=$ZIPFILE_NAME" >> $GITHUB_OUTPUT
ls -lha $GITHUB_WORKSPACE/dist/
- name: Upload zip as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build-testing-package.outputs.ZIPFILE_NAME }}
path: $GITHUB_WORKSPACE/dist/${{ steps.build-testing-package.outputs.ZIPFILE_NAME }}
retention-days: 7
- name: Echo the URL for the artifact
run: |
echo "Artifact URL: ${{ steps.upload-artifact.outputs.artifact_url }}"