Skip to content

Merge branch 'master' of github.com:demyxsh/wordpress #107

Merge branch 'master' of github.com:demyxsh/wordpress

Merge branch 'master' of github.com:demyxsh/wordpress #107

Workflow file for this run

name: demyx/wordpress
on:
push:
branches:
- master
schedule:
- cron: '0 0 * * 6'
jobs:
master:
runs-on: ubuntu-latest
env:
DEMYX_REPOSITORY: wordpress
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login
uses: docker/login-action@v1
with:
username: demyx
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: |
docker pull alpine
docker pull demyx/nginx
docker pull demyx/mariadb
docker build -t demyx/${{ env.DEMYX_REPOSITORY }} tag-latest
docker build -t demyx/${{ env.DEMYX_REPOSITORY }}:bedrock tag-bedrock
docker build -t demyx/${{ env.DEMYX_REPOSITORY }}:cli tag-cli
docker build -t demyx/${{ env.DEMYX_REPOSITORY }}:7.4 tag-7.4
- name: Test
id: test
shell: 'script -q -e -c "bash {0}"'
run: |
docker network create demyx
# tag-latest test
docker run -d \
--name=demyx_db \
--network=demyx \
-e DEMYX_DATABASE=demyx \
-e DEMYX_USERNAME=demyx \
-e DEMYX_PASSWORD=demyx \
-e DEMYX_ROOT_PASSWORD=demyx \
demyx/mariadb
sleep 5
docker run -d \
--name=${{ env.DEMYX_REPOSITORY }} \
--network=demyx \
-v ${{ env.DEMYX_REPOSITORY }}:/demyx \
-e DEMYX_DB_HOST=demyx_db \
-e DEMYX_DB_NAME=demyx \
-e DEMYX_DB_USER=demyx \
-e DEMYX_DB_PASSWORD=demyx \
-e DEMYX_DOMAIN=localhost \
demyx/${{ env.DEMYX_REPOSITORY }}
docker run -d \
--name=demyx_nx \
--network=demyx \
-v ${{ env.DEMYX_REPOSITORY }}:/demyx \
-e DEMYX_WORDPRESS=true \
-e DEMYX_WORDPRESS_CONTAINER=${{ env.DEMYX_REPOSITORY }} \
-e DEMYX_DOMAIN=localhost \
demyx/nginx
# tag-bedrock test
docker run -d \
--name=demyx_db_bedrock \
--network=demyx \
-e DEMYX_DATABASE=demyx \
-e DEMYX_USERNAME=demyx \
-e DEMYX_PASSWORD=demyx \
-e DEMYX_ROOT_PASSWORD=demyx \
demyx/mariadb
sleep 5
docker run -d \
--name=${{ env.DEMYX_REPOSITORY }}_bedrock \
--network=demyx \
-v ${{ env.DEMYX_REPOSITORY }}_bedrock:/demyx \
-e DEMYX_DB_HOST=demyx_db_bedrock \
-e DEMYX_DB_NAME=demyx \
-e DEMYX_DB_USER=demyx \
-e DEMYX_DB_PASSWORD=demyx \
-e DEMYX_DOMAIN=localhost \
demyx/${{ env.DEMYX_REPOSITORY }}:bedrock
docker run -d \
--name=demyx_nx_bedrock \
--network=demyx \
-v ${{ env.DEMYX_REPOSITORY }}_bedrock:/demyx \
-e DEMYX_BEDROCK=true \
-e DEMYX_WORDPRESS=true \
-e DEMYX_WORDPRESS_CONTAINER=${{ env.DEMYX_REPOSITORY }}_bedrock \
-e DEMYX_DOMAIN=localhost \
demyx/nginx
sleep 5
DEMYX_TEST="$(docker exec demyx_nx sh -c "wget -qO- http://localhost" 2>&1)"
DEMYX_TEST_BEDROCK="$(docker exec demyx_nx_bedrock sh -c "wget -qO- http://localhost" 2>&1)"
if [[ "$DEMYX_TEST" == *"Hello world"* && "$DEMYX_TEST_BEDROCK" == *"Hello world"* ]]; then
echo "Tests passed."
else
exit 1
fi
- name: Version
run: |
DEMYX_WORDPRESS_ALPINE_VERSION="$(docker exec ${{ env.DEMYX_REPOSITORY }} cat /etc/os-release | grep VERSION_ID | cut -c 12-)"
DEMYX_WORDPRESS_VERSION="$(docker run --rm --volumes-from=${{ env.DEMYX_REPOSITORY }} --network container:${{ env.DEMYX_REPOSITORY }} demyx/${{ env.DEMYX_REPOSITORY }}:cli core version)"
DEMYX_WORDPRESS_BEDROCK_VERSION="$(curl -sL https://api.github.com/repos/roots/bedrock/releases/latest | jq -r '.tag_name')"
DEMYX_WORDPRESS_CLI_VERSION="$(docker run --rm demyx/${{ env.DEMYX_REPOSITORY }}:cli --version | awk -F '[ ]' '{print $2}')"
DEMYX_WORDPRESS_PHP_VERSION="$(docker exec ${{ env.DEMYX_REPOSITORY }} php -v | grep cli | awk -F '[ ]' '{print $2}')"
DEMYX_WORDPRESS_PHP_LATEST_VERSION="$(docker exec ${{ env.DEMYX_REPOSITORY }} php81 -v | grep cli | awk -F '[ ]' '{print $2}')"
DEMYX_JQ="$(jq ".alpine = \"$DEMYX_WORDPRESS_ALPINE_VERSION\" | .wordpress = \"$DEMYX_WORDPRESS_VERSION\" | .bedrock = \"$DEMYX_WORDPRESS_BEDROCK_VERSION\" | .wp_cli = \"$DEMYX_WORDPRESS_CLI_VERSION\" | .php = \"$DEMYX_WORDPRESS_PHP_VERSION\" | .php81 = \"$DEMYX_WORDPRESS_PHP_LATEST_VERSION\"" version.json)"
# Update versions
echo "$DEMYX_JQ" > version.json
echo "DEMYX_WORDPRESS_ALPINE_VERSION=$DEMYX_WORDPRESS_ALPINE_VERSION
DEMYX_WORDPRESS_VERSION=$DEMYX_WORDPRESS_VERSION
DEMYX_WORDPRESS_BEDROCK_VERSION=$DEMYX_WORDPRESS_BEDROCK_VERSION
DEMYX_WORDPRESS_CLI_VERSION=$DEMYX_WORDPRESS_CLI_VERSION
DEMYX_WORDPRESS_PHP_VERSION=$DEMYX_WORDPRESS_PHP_VERSION
DEMYX_WORDPRESS_PHP_LATEST_VERSION=$DEMYX_WORDPRESS_PHP_LATEST_VERSION" > VERSION
- name: Push
run: |
# Not sure why this is being created?
[[ -f typescript ]] && rm -f typescript
DEMYX_CHECK_STATUS="$(git status)"
if [[ "$DEMYX_CHECK_STATUS" != *"nothing to commit"* ]]; then
DEMYX_RANDOM_QUOTE="$(curl -s "https://api.quotable.io/random?tags=technology" | jq -r '. | "\"\(.content)\" - \(.author)"')"
git config --global user.name github-actions[bot]
git config --global user.email github-actions[bot]@users.noreply.github.com
git remote set-url origin https://demyxsh:${{ secrets.DEMYX_TOKEN }}@github.com/demyxsh/${{ env.DEMYX_REPOSITORY }}
git add .
git commit -m "${DEMYX_RANDOM_QUOTE:-Scheduled Build}"
git push
fi
docker push demyx/${{ env.DEMYX_REPOSITORY }}
docker push demyx/${{ env.DEMYX_REPOSITORY }}:cli
docker push demyx/${{ env.DEMYX_REPOSITORY }}:bedrock
docker push demyx/${{ env.DEMYX_REPOSITORY }}:7.4