Compare commits
No commits in common. "fbb4e22dc76827c6bd8a88b5417e0328fe4eb2b1" and "8e4164d0180a126e3ddb3b3f544a4e0bdd197197" have entirely different histories.
fbb4e22dc7
...
8e4164d018
2 changed files with 30 additions and 98 deletions
|
@ -1,94 +1,45 @@
|
||||||
# Building and releasing Wordpress plugins is pretty simple
|
name: Build Plugin Zip
|
||||||
# It's just zipping up some PHP. This doesn't contain any unit tests
|
|
||||||
# this is just zipping and shipping.
|
|
||||||
#
|
|
||||||
# Generally speaking your directory structure would be:
|
|
||||||
# .
|
|
||||||
# ├── README.md
|
|
||||||
# └── src
|
|
||||||
# └── wordpress-plugin.php
|
|
||||||
#
|
|
||||||
# With the repository name being the name of your plugin to make it easier
|
|
||||||
# to Google for. Up to you though; you can configure the source dir below.
|
|
||||||
#
|
|
||||||
# When you tag a commit and the tag stats with 'v', this workflow will
|
|
||||||
# zip and ship the Wordpress plugin to the 'releases' tab of Github or Forgejo
|
|
||||||
|
|
||||||
name: Build & Release WordPress Plugin
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
branches:
|
||||||
- 'v*'
|
- main
|
||||||
|
workflow_dispatch: # Manual trigger
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-zip:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container: debian:12
|
|
||||||
|
|
||||||
env:
|
|
||||||
SOURCE_DIR: "src"
|
|
||||||
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Prepare Build Environment
|
|
||||||
run: |
|
|
||||||
apt update && apt -y install zip unzip nodejs curl jq
|
|
||||||
|
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Package plugin
|
- name: Get repo name
|
||||||
|
id: repo_name
|
||||||
|
run: echo "REPO_NAME=$(basename $(git rev-parse --show-toplevel))" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Prepare zip folder
|
||||||
run: |
|
run: |
|
||||||
# Set plugin name like this because it's easier than inline
|
rm -rf /tmp/$REPO_NAME
|
||||||
PLUGIN_NAME=$(echo $GITHUB_REPOSITORY | awk -F'/' '{ print $2 }')
|
mkdir -p /tmp/$REPO_NAME
|
||||||
|
cp -r ./src/* /tmp/$REPO_NAME/
|
||||||
|
|
||||||
# Create a build directory to ensure that we're correctly creating
|
- name: Create zip archive
|
||||||
# a single child directory in the zip.
|
|
||||||
mkdir -p build
|
|
||||||
cp -r ${SOURCE_DIR} "build/${PLUGIN_NAME}"
|
|
||||||
|
|
||||||
# Zip it up for shipping
|
|
||||||
cd build
|
|
||||||
zip -r "../${PLUGIN_NAME}.zip" "${PLUGIN_NAME}"
|
|
||||||
cd -
|
|
||||||
unzip -l "${PLUGIN_NAME}.zip"
|
|
||||||
|
|
||||||
- name: Create Release if not exists
|
|
||||||
run: |
|
run: |
|
||||||
# Curl request that uses the repos token & Forgejo's built-in variables
|
apt update && apt -y install zip
|
||||||
# to create a new release based on the tag that you have pushed
|
cd /tmp
|
||||||
#
|
zip -r $REPO_NAME.zip $REPO_NAME
|
||||||
# It doesn't care if the release exists or not.
|
|
||||||
curl -X POST "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases" \
|
|
||||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{
|
|
||||||
"tag_name": "'"${GITHUB_REF##*/}"'",
|
|
||||||
"target_commitish": "main",
|
|
||||||
"name": "'"${GITHUB_REF##*/}"'",
|
|
||||||
"body": "Auto release",
|
|
||||||
"draft": false,
|
|
||||||
"prerelease": false
|
|
||||||
}' || true
|
|
||||||
|
|
||||||
- name: Upload Plugin Zip to Release
|
|
||||||
run: |
|
|
||||||
# Set some variables because it's cleaner than in-line
|
|
||||||
TAG_NAME="${GITHUB_REF##*/}"
|
|
||||||
REPO_NAME="$(basename $GITHUB_REPOSITORY)"
|
|
||||||
PLUGIN_NAME=$(echo $GITHUB_REPOSITORY | awk -F'/' '{ print $2 }')
|
|
||||||
|
|
||||||
# Get the release ID created in the last step
|
- name: Upload zip artifact
|
||||||
RELEASE_ID=$(curl -s \
|
uses: actions/upload-artifact@v3
|
||||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
with:
|
||||||
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/tags/${TAG_NAME}" \
|
name: ${{ env.REPO_NAME }}-plugin-zip
|
||||||
| jq -r '.id')
|
path: /tmp/${{ env.REPO_NAME }}.zip
|
||||||
|
|
||||||
# Pushes he zip file to be shown in the "Releases" tab under this release.
|
|
||||||
curl -X POST "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets" \
|
|
||||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
||||||
-F "name=${PLUGIN_NAME}.zip" \
|
|
||||||
-F "attachment=@${PLUGIN_NAME}.zip"
|
|
||||||
|
|
||||||
|
- name: Upload Release Asset
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
with:
|
||||||
|
upload_url: ${{ github.event.release.upload_url }}
|
||||||
|
asset_path: build/${{ env.REPO_NAME }}.zip
|
||||||
|
asset_name: ${{ env.REPO_NAME }}.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
|
|
19
README.md
19
README.md
|
@ -21,22 +21,3 @@ this information when a shortcode (`[event-calendar]`) is called.
|
||||||
|
|
||||||
We store a list/array of URLs to pull from, so you should be able to add a
|
We store a list/array of URLs to pull from, so you should be able to add a
|
||||||
couple.
|
couple.
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Just install then look in "Settings" for the "FWP Calendar" section.
|
|
||||||
|
|
||||||
You can add a simple list of ICS/iCal URLs there however they must be publicly
|
|
||||||
accessible. I tested and it works with Google calendars.
|
|
||||||
|
|
||||||
I created this for a customer who had a list of upcoming events displayed on
|
|
||||||
their website. They were manually updating the events calendar entirely through
|
|
||||||
Wordpress, which seemed clunky.
|
|
||||||
|
|
||||||
This plugin allows you to maintain a community events calendar from within your
|
|
||||||
Orgs typical public calendar. Visitors can see events spread out on a calendar
|
|
||||||
and upcoming events below.
|
|
||||||
|
|
||||||
This is good because you can provide the calendar for people to add to their
|
|
||||||
phones or import into their own calendars. Your options are endless when you
|
|
||||||
don't use shitty proprietary standards!
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue