Comments (3)
I've been experimenting with bash
scripting and regex and have the following as a potential starting point to fix the 3 issues raised about the last attempted code, specifically these issues were:
- The current substitution command will lead to invalid replacements
over time since it isn't limited to the specific place in the file that
should be edited. - The 'other' versions array indicating which beta/RC releases of
WordPress should be allowed is not updated. - This action probably does not correctly handle "5.9" vs "5.9.0" in
major WP versions.
The code below hopefully makes the substitution more specific, it handles the 'other' versions more specifically and it also handles the WP release versioning better. It may well be clunky and I expected more improvements can be made but posting here so there is a record and starting point.
name: Check for WordPress release
on:
schedule:
- cron: '0 1 * * *'
jobs:
release-check:
runs-on: ubuntu-latest
steps:
- name: Check release repository
run: |
echo "Collect and process json"
RELEASE_DATA=$(wget -cq "https://api.wordpress.org/core/version-check/1.7/" -O - | jq --compact-output '.[] | limit( 1; .[] ) | {current}')
CURRENT_DATA=$(echo ${RELEASE_DATA} | grep -Eo -m1 '[[:digit:]]+\.[[:digit:]]+\.?[[:digit:]]*')
echo "current_version=${CURRENT_VERSION}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v2
- name: Compare to Repository
run: |
MAX_WP_VERSION=$(grep -Eo -m1 "'max'\s*=>\s'([[:digit:]]\.[[:digit:]]\.?[[:digit:]]*)'" ./v1/migration/index.php)
echo ${MAX_WP_VERSION} > ./max_wp_version.txt
WP_VERSION=$(echo "${MAX_WP_VERSION}" | grep -Eo -m1 '[[:digit:]]\.[[:digit:]]\.?[[:digit:]]*')
if [ ${{ env.current_version }} != ${WP_VERSION} ]; then
sed -i "s|${WP_VERSION}|${{ env.current_version}}|" ./max_wp_version.txt
NEW_WP_VERSION=$(cat ./max_wp_version.txt)
sed -i "s|${MAX_WP_VERSION}|${NEW_WP_VERSION}|" ./v1/migration/index.php
PARTS=(`echo ${{ env.current_version}} | tr '.' ' '`)
if [ -z $PARTS[3] ]; then
NEW_PATCH_RELEASE=$(echo ${PARTS[1]}.${PARTS[2]}.1)
else
NEW_PATCH_RELEASE=$(echo ${PARTS[1]}.${PARTS[2]}.$(( ${PARTS[3]} + 1 )))
fi
if [ 9 = ${PARTS[2]} ]; then
NEW_RELEASE=$(echo $(( ${PARTS[1]} + 1 )).0)
else
NEW_RELEASE=$(echo ${PARTS[1]}.$(( ${PARTS[2]} + 1 )))
fi
PATCH_RC_VERSION=$(grep -Eo -m1 "(#\^[[:digit:]]+\\\.[[:digit:]]+\\\.[[:digit:]]+)-\(alpha" ./v1/migration/index.php)
RC_VERSION=$(grep -Eo -m1 "(#\^[[:digit:]]+\\\.[[:digit:]]+)-\(alpha" ./v1/migration/index.php)
sed -i "s|${PATCH_RC_VERSION}|${NEW_PATCH_RELEASE}|" ./v1/migration/index.php
sed -i "s|${RC_VERSION}|${NEW_RELEASE}|" ./v1/migration/index.php
- name: Create Pull Request
id: createpr
uses: peter-evans/create-pull-request@v3
with:
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: release/${{ env.current_version }}
commit-message: Update API for new WordPressPress Release
title: Update API for ${{ env.current_version }} release
body: |
Update API Endpoint
- Update endpoint to release ${{ env.current_version }}
- Update release date to ${{ env.release_date }}
from classicpress-apis.
@mattyrob is there a place for us to test this?
from classicpress-apis.
@bahiirwa It is possible to test step wise in in Linux command line. With higher confidence in what we have we can create and tweak the workflow later if needed.
from classicpress-apis.
Related Issues (17)
- Improve error handling in features endpoint
- Add API endpoint for "latest version" HOT 2
- Add alpha/beta/RC channels for upgrades HOT 2
- Separate upgrade responses list into "release" and "nightly"
- Add checksums API HOT 4
- Setup API Endpoints HOT 1
- Support forum petitions endpoint HOT 12
- Add API endpoint for feature votes HOT 11
- Support PHP Migration check HOT 1
- Add setting to override API while testing HOT 1
- Make update/upgrade endpoints pull from GitHub dynamically HOT 1
- Update features API endpoint to use GitHub API
- Add api.wordpress.org/core/importers/1.1 HOT 2
- Initial plan for auto-updates and versioning HOT 2
- Clean up core API endpoints
- Endpoints for translation HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from classicpress-apis.