Skip to content

Update VERSION for 1.0.3 #4

Update VERSION for 1.0.3

Update VERSION for 1.0.3 #4

Workflow file for this run

# builds the content of http://github.com/orgrosua/yabe-movebender
# inspiration from https://github.com/rectorphp/rector-src/blob/main/.github/workflows/build_scoped_rector.yaml
name: Build and Publish release to WordPress repository
on:
push:
# branches:
# - main
tags:
- '*'
env:
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
COMPOSER_ROOT_VERSION: "dev-main"
jobs:
build_scoped_orgrosua:
# Don't run on forks.
if: github.repository == 'orgrosua/yabe-movebender'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
# sometime, when 2 or more consecutive PRs merged, the checkout orgrosua/yabe-movebender is overlapped
# and reverting other commit change
# this should not happen on create a tag, so wait first
# - name: "Wait before checkout orgrosua/yabe-movebender on create a tag"
# if: "startsWith(github.ref, 'refs/tags/')"
# run: sleep 120
- uses: actions/checkout@v3
with:
fetch-depth: 0
# Get the current tag from github.ref, where the tag name is the version number.
# tag name pattern: X.Y.Z, where X, Y, Z are integers
# reduce the X by 1, then build the tag name
# save the tag name as `TAG_NAME` variable to file $GITHUB_ENV
# Note, set-output is deprecated, so use alternative instead of ::set-output
# - name: "Get the current tag"
# id: get_tag
# run: |
# echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/} | awk -F. '{print $1-1"."$2"."$3}')" >> $GITHUB_ENV
- name: "Get the current tag"
id: get_tag
run: |
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
# clean up the dev files
- run: rm -rf ecs.php rector.php
# Use pnpm to install dependencies and build the assets.
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'pnpm'
# Font Awesome Pro. https://fontawesome.com/docs/web/setup/packages
- run: npm config set "@fortawesome:registry" https://npm.fontawesome.com/
- run: npm config set "//npm.fontawesome.com/:_authToken" ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
- run: pnpm install
- run: pnpm build
# clean up the assets dev files
- run: rm -rf assets node_modules package.json pnpm-lock.yaml webpack.config.js vite.config.js
# scoped using php-scoper.phar which require #[\ReturnTypeWillChange] inside so use php 8.0 for scoping
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none
# fixes https://github.com/rectorphp/rector/pull/4559/checks?check_run_id=1359814403, see https://github.com/shivammathur/setup-php#composer-github-oauth
env:
COMPOSER_TOKEN: ${{ secrets.ORGROSUA_DEV_PAT }}
# remove custom update library
# - run: composer remove rosua/edd-sl-plugin-updater --ansi
# install only prod dependencies
- run: composer install --no-dev --classmap-authoritative --ansi
# copy files to $NESTED_DIRECTORY directory Exclude the scoped/nested directories to prevent rsync from copying in a loop
- run: rsync --exclude orgrosua-deploy -av * orgrosua-deploy --quiet
# humbug/php-scoper requires php ^8.1
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
# prefix the namespaces
- run: sh deploy/deploy-scoped.sh orgrosua-deploy orgrosua-prefixed
# deploy to WordPress.org SVN repository
# - name: WordPress Plugin Deploy
# uses: 10up/action-wordpress-plugin-deploy@stable
# env:
# SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
# SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
# SLUG: yabe-movebender
# BUILD_DIR: orgrosua-prefixed
# VERSION: ${{ env.TAG_NAME }}
# clone remote repository, so we can push it
- uses: "actions/checkout@v3"
with:
repository: orgrosua/yabe-movebender-release
ref: main
path: remote-repository
token: ${{ secrets.ORGROSUA_DEV_PAT }}
# remove remote files, to avoid piling up dead code in remote repository
- working-directory: remote-repository
run: |
git rm -rf .
git clean -fxd
# copy files to remote repository
- run: cp -a orgrosua-prefixed/. remote-repository
# setup git
- working-directory: remote-repository
run: |
git config user.name "Joshua Gugun Siagian"
git config user.email suabahasa@gmail.com
# commit metadata
- name: "Get Git log"
id: git-log
run: |
echo "log<<EOF" >> $GITHUB_OUTPUT
echo "$(git log ${{ github.event.before }}..${{ github.event.after }} --reverse --pretty='https://github.com/orgrosua/yabe-movebender/commit/%H %s')" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
# publish it to remote repository without tag
# - name: "Commit Prefixed - main"
# working-directory: remote-repository
# if: "!startsWith(github.ref, 'refs/tags/')"
# run: |
# git add --all
# git commit -m "Updated Yabe Movebender to commit ${{ github.event.after }}" -m "${{ steps.git-log.outputs.log }}"
# git push --quiet origin main
# publish it to remote repository with tag, where the tag is from the previous step, env.TAG_NAME
- name: "Commit Prefixed - tag"
working-directory: remote-repository
if: "startsWith(github.ref, 'refs/tags/')"
env:
INPUT_LOG: ${{ steps.git-log.outputs.log }}
# run: |
# git add --all
# git commit -m "Yabe Movebender ${GITHUB_REF#refs/tags/}" -m "$INPUT_LOG"
# git push --quiet origin main
# git tag ${GITHUB_REF#refs/tags/} -m "${GITHUB_REF#refs/tags/}"
# git push --quiet origin ${GITHUB_REF#refs/tags/}
run: |
git add --all
git commit -m "Yabe Movebender ${{env.TAG_NAME}}" -m "$INPUT_LOG"
git push --quiet origin main
git tag ${{env.TAG_NAME}} -m "${{env.TAG_NAME}}"
git push --quiet origin ${{env.TAG_NAME}}