Updated build process to shutup 'Warning: The TextDomain header in th… #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build, Test and Version plugin | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-test-version-and-create-release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get base version from VERSION.md | |
id: get_base_version | |
run: echo "BASE_VERSION=$(cat VERSION.md)" >> $GITHUB_OUTPUT | |
- name: Get latest tag | |
id: get_latest_tag | |
run: echo "LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo v0.0)" >> $GITHUB_OUTPUT | |
- name: Determine new version | |
id: determine_version | |
run: | | |
base_version="${{ steps.get_base_version.outputs.BASE_VERSION }}" | |
# Remove 'v' prefix if present | |
base_version="${base_version#v}" | |
# Split the base version into major and minor | |
IFS='.' read -r major minor <<< "$base_version" | |
# Get the latest tag that matches the major version | |
latest_tag=$(git tag -l "v$major.*" | sort -V | tail -n1) | |
if [ -n "$latest_tag" ]; then | |
# If a matching tag exists, increment its minor version | |
current_minor=$(echo $latest_tag | awk -F. '{print $2}') | |
new_minor=$((current_minor + 1)) | |
else | |
# If no matching tag exists, use the minor version from VERSION.md | |
new_minor=$minor | |
fi | |
# Construct the new version | |
new_version="$major.$new_minor" | |
new_version_with_v="v$new_version" | |
echo "NEW_VERSION=$new_version" >> $GITHUB_OUTPUT | |
echo "NEW_VERSION_WITH_V=$new_version_with_v" >> $GITHUB_OUTPUT | |
- name: Build plugin | |
run: | | |
chmod +x build.sh | |
./build.sh ${{ steps.determine_version.outputs.NEW_VERSION }} | |
- name: Run plugin check | |
uses: wordpress/plugin-check-action@v1 | |
with: | |
build-dir: build | |
- name: Create and push new tag | |
if: success() | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git tag ${{ steps.determine_version.outputs.NEW_VERSION_WITH_V }} | |
git push origin ${{ steps.determine_version.outputs.NEW_VERSION_WITH_V }} | |
- name: Trigger build and release | |
if: success() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh workflow run release.yml --ref ${{ steps.determine_version.outputs.NEW_VERSION_WITH_V }} | |
- name: Cleanup | |
if: always() | |
run: | | |
./cleanup.sh | |
outputs: | |
new_version: ${{ steps.determine_version.outputs.NEW_VERSION_WITH_V }} |