Skip to content

Commit

Permalink
Playground block: Release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel committed May 22, 2024
1 parent e7276a1 commit 43751d0
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions .
67 changes: 67 additions & 0 deletions .github/workflows/release-playground-block.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name : Release the Playground block
on :
workflow_dispatch :

jobs :
release :
if : >
github.ref == 'refs/heads/trunk' && (
github.actor == 'adamziel' ||
github.actor == 'dmsnell' ||
github.actor == 'bgrgicak' ||
github.actor == 'sejas' ||
github.actor == 'danielbachchuber'
)
# Specify runner + deployment step
runs-on : ubuntu-latest
environment : Playground Block
steps :
- uses : actions/ checkout@v3
with :
ref : ${{ github.event.pull_request.head.ref }}
clean : true
fetch-depth : zero
persist-credentials : false
- name : Setup SSH Keys
uses : webfactory/ ssh-agent@v0.5.3
with :
ssh-private-key : ${{ secrets.GH_DEPLOY_KEY }}
- name : Clone the SVN repo
run : |
mkdir -p svn-clone
svn co http://plugins.svn.wordpress.org/interactive-code-block/ svn-clone
- name : Compute the next tag
run : |
ALL_TAGS=$(ls svn-clone/tags)
LAST_TAG=$(echo "$ALL_TAGS" | sort -V | tail -n 1)
NEXT_TAG=$(echo "$LAST_TAG" | awk -F. '{printf "%s.%s.%s\n", $1, $2, $3+1}')
echo "ALL_TAGS=$ALL_TAGS" >> $GITHUB_ENV
echo "LAST_TAG=$LAST_TAG" >> $GITHUB_ENV
echo "NEXT_TAG=$NEXT_TAG" >> $GITHUB_ENV
- name : Bump the version
run : |
perl -i -pe 's/Version:(\s+)[0-9.]+/Version:${1}'$NEXT_TAG'/' packages/wordpress-playground-block/wordpress-playground-block.php
perl -i -pe 's/Stable tag:(\s+)[0-9.]+/Stable tag:${1}'$NEXT_TAG'/' packages/wordpress-playground-block/README.plugindirectory.txt
- name : Commit the version bump
run : |
git config --global user.name "deployment_bot"
git config --global user.email " deployment_bot@users.noreply.github.com "
git commit -a -m "Playground Block: Version bump "$NEXT_TAG --no-verify
git push git@github.com :wordpress/playground-tools.git --follow-tags
- name : Install dependencies
run : npm ci
- name : Build the block and tag the release
run : |
nx build wordpress-playground-block
rm -rf svn-clone/trunk
cp -r dist/packages/wordpress-playground-block svn-clone/trunk
cp -r dist/packages/wordpress-playground-block svn-clone/tags/$NEXT_TAG
- name : Commit the release
env :
SVN_USERNAME : ${{ secrets.PLAYGROUND_BLOCK_SVN_USERNAME }}
SVN_PASSWORD : ${{ secrets.PLAYGROUND_BLOCK_SVN_PASSWORD }}
run : |
cd svn-clone
svn add trunk tags/$NEXT_TAG
svn commit -m "Release "$NEXT_TAG --username $SVN_USERNAME --password $SVN_PASSWORD --non-interactive --trust-server-cert
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ packages/docs/site/src/model.json
.docusaurus
dist.zip
build
svn-clone

# dependencies
node_modules
Expand Down

0 comments on commit 43751d0

Please sign in to comment.