50 lines
1.3 KiB
YAML
50 lines
1.3 KiB
YAML
name: Package Plugin
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
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 }} |