demyx/demyx #166
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: demyx/demyx | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 0 * * 6' | |
workflow_dispatch: | |
jobs: | |
master: | |
runs-on: ubuntu-latest | |
env: | |
DEMYX_REPOSITORY: demyx | |
DEMYX_VERSION: 1.8.3 | |
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 demyx/docker-compose | |
docker pull demyx/docker-socket-proxy | |
docker pull demyx/mariadb | |
docker pull demyx/nginx | |
docker pull demyx/traefik | |
docker pull demyx/utilities | |
docker pull demyx/wordpress | |
docker pull alpine:3.17 | |
docker build --build-arg DEMYX_BUILD="$(date +%F-%T)" -t demyx/${{ env.DEMYX_REPOSITORY }} -t demyx/${{ env.DEMYX_REPOSITORY }}:${{ env.DEMYX_VERSION }} . | |
- name: Test | |
id: test | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
docker volume create demyx | |
sudo touch /var/lib/docker/volumes/demyx/_data/github_action | |
sudo cp host.sh /usr/local/bin/demyx | |
sudo chmod +x /usr/local/bin/demyx | |
demyx motd | |
demyx run demyx.app | |
demyx wp demyx.app core is-installed | |
DEMYX_TEST="$(demyx exec demyx.app -n wget -qO- http://localhost 2>&1)" | |
if [[ "$DEMYX_TEST" == *"Hello world"* && ! -f /var/lib/docker/volumes/demyx/_data/tmp/demyx_log_error ]]; then | |
echo "Passed." | |
else | |
echo "$DEMYX_TEST" | |
exit 1 | |
fi | |
- name: Version | |
run: | | |
DEMYX_ALPINE_VERSION="$(docker exec --user=root ${{ env.DEMYX_REPOSITORY }} cat /etc/os-release | grep VERSION_ID | cut -c 12-)" | |
DEMYX_DOCKER_VERSION="$(docker exec --user=root ${{ env.DEMYX_REPOSITORY }} docker version | grep Version: | head -n 1 | awk -F ' ' '{print $2}')" | |
DEMYX_JQ="$(jq ".alpine = \"$DEMYX_ALPINE_VERSION\" | .demyx = \"$DEMYX_VERSION\" | .docker = \"$DEMYX_DOCKER_VERSION\" | .docker_compose = \"$DEMYX_DOCKER_COMPOSE_VERSION\"" version.json)" | |
# Update versions | |
echo "$DEMYX_JQ" > version.json | |
echo "DEMYX_ALPINE_VERSION=$DEMYX_ALPINE_VERSION | |
DEMYX_VERSION=$DEMYX_VERSION | |
DEMYX_DOCKER_VERSION=$DEMYX_DOCKER_VERSION | |
DEMYX_DOCKER_COMPOSE_VERSION=$DEMYX_DOCKER_COMPOSE_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 }}:${{ env.DEMYX_VERSION }} |