-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitHub Action – Publish Release (#203)
* drafting github action for publishing new releases * update bundle script to export zip file abspath in GitHub Actions * only run phpcs when PHP files are updated * improve entire folder exclusions * attempt to fix grep compatibility, attempt artifact upload * fix artifact name extra zip suffix, attempt dry run wporg publish * rn exclusions list to standard distignore filename * finalize publish release workflow events
- Loading branch information
1 parent
ec4dc5c
commit 4fb7425
Showing
6 changed files
with
83 additions
and
8 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
name: PHPCS Check | ||
|
||
on: [pull_request] | ||
on: | ||
pull_request: | ||
paths: | ||
- '**.php' | ||
|
||
jobs: | ||
phpcs: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Publish Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
- "!v**-rc.*" | ||
|
||
jobs: | ||
tag: | ||
name: New release | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build - Install | ||
run: ./build_install.sh | ||
shell: bash | ||
|
||
- name: Bundle Package | ||
run: ./bundle.sh | ||
shell: bash | ||
|
||
- name: Upload ZIP File | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.PTC_PLUGIN_ZIP_FILE_BASENAME }} | ||
path: ${{ env.PTC_PLUGIN_ZIP_FILE }} | ||
|
||
- name: Publish WordPress Plugin Release | ||
uses: 10up/action-wordpress-plugin-deploy@stable | ||
with: | ||
dry-run: true | ||
generate-zip: false | ||
env: | ||
SVN_USERNAME: ${{ secrets.WPORG_SVN_USERNAME }} | ||
SVN_PASSWORD: ${{ secrets.WPORG_SVN_PASSWORD }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/bash | ||
|
||
for PATTERN in $(cat "exclude.lst") | ||
for PATTERN in $(cat ".distignore") | ||
do rm -rf "../"${PATTERN} | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,33 @@ | ||
#!/bin/bash | ||
|
||
# Determine package values. | ||
|
||
PLUGIN_SLUG=$( basename `pwd` ) | ||
|
||
VERSION=$(grep -Eio 'Version:\s*[0-9\.]+' "${PLUGIN_SLUG}.php" | grep -Eo '[0-9\.]+') | ||
VERSION=$(grep -Eio 'Version:\s*[0-9]+\.[0-9]+\.[0-9]+(\-rc\.[0-9]+)?' "${PLUGIN_SLUG}.php" | grep -Eio '[0-9]+\.[0-9]+\.[0-9]+(\-rc\.[0-9]+)?') | ||
|
||
# Create the plugin package. | ||
|
||
pushd .. | ||
|
||
PLUGIN_ZIP_FILE=$( pwd )/"${PLUGIN_SLUG}-${VERSION}.zip" | ||
|
||
zip -rT9X "${PLUGIN_ZIP_FILE}" "${PLUGIN_SLUG}" --exclude @"${PLUGIN_SLUG}"/.distignore | ||
|
||
popd | ||
|
||
# Maybe export variables for GitHub Action. | ||
|
||
if [ -n "$GITHUB_ENV" ]; then | ||
echo "PTC_PLUGIN_ZIP_FILE_BASENAME=$( basename -s '.zip' "$PLUGIN_ZIP_FILE" )" >> "$GITHUB_ENV" | ||
echo "PTC_PLUGIN_ZIP_FILE=${PLUGIN_ZIP_FILE}" >> "$GITHUB_ENV" | ||
echo "Exported GitHub ENV variables." | ||
else | ||
echo "Did not set \$GITHUB_ENV variables." | ||
fi | ||
|
||
# Final notes. | ||
|
||
cd .. | ||
zip -rT9X "${PLUGIN_SLUG}-${VERSION}.zip" "${PLUGIN_SLUG}" --exclude @"${PLUGIN_SLUG}"/exclude.lst | ||
echo | ||
echo "!! Finished bundling plugin package: ${PLUGIN_ZIP_FILE}" | ||
echo |
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