Files
HTBD/.github/workflows/package-plugin.yml
T
2026-07-31 19:53:38 +08:00

61 lines
1.7 KiB
YAML

name: Package Plugin
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
workflow_dispatch:
permissions:
actions: write
contents: write
jobs:
package:
name: Package plugin
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install gettext
run: sudo apt-get update && sudo apt-get install --yes gettext
- name: Build installable plugin archive
id: package
run: |
set -eu
version="$(grep -E '^ \* Version:' hyx-translator-for-baidu-translate.php | sed -E 's/^ \* Version: *//')"
archive_name="hyx-translator-for-baidu-translate-${version}.zip"
./build.sh build
printf 'archive=%s\n' "${archive_name}" >> "$GITHUB_OUTPUT"
- name: Upload plugin archive
uses: actions/upload-artifact@v4
with:
name: hyx-translator-for-baidu-translate-plugin
path: ${{ steps.package.outputs.archive }}
if-no-files-found: error
retention-days: 30
- name: Publish plugin ZIP to GitHub Release
if: startsWith( github.ref, 'refs/tags/v' )
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.package.outputs.archive }}
- name: Deploy GitHub Release to WordPress.org SVN
if: startsWith( github.ref, 'refs/tags/v' )
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
GH_TOKEN: ${{ github.token }}
run: |
gh workflow run deploy-wordpress-svn.yml \
--ref "${DEFAULT_BRANCH}" \
--field release_tag="${GITHUB_REF_NAME}"