demyx/code-server #139
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/code-server | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 0 * * 6' | |
jobs: | |
master: | |
runs-on: ubuntu-latest | |
env: | |
DEMYX_REPOSITORY: code-server | |
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 debian:buster-slim | |
docker pull docker | |
docker pull golang:buster | |
docker pull koalaman/shellcheck | |
docker pull php:7-fpm-buster | |
docker pull quay.io/vektorlab/ctop | |
docker build --no-cache -t demyx/${{ env.DEMYX_REPOSITORY }}:bedrock tag-bedrock | |
docker build --no-cache -t demyx/${{ env.DEMYX_REPOSITORY }}:browse tag-browse | |
docker build --no-cache -t demyx/${{ env.DEMYX_REPOSITORY }}:go tag-go | |
docker build --no-cache -t demyx/${{ env.DEMYX_REPOSITORY }}:latest tag-latest | |
docker build --no-cache -t demyx/${{ env.DEMYX_REPOSITORY }}:openlitespeed tag-openlitespeed | |
docker build --no-cache -t demyx/${{ env.DEMYX_REPOSITORY }}:openlitespeed-bedrock tag-openlitespeed-bedrock | |
docker build --no-cache -t demyx/${{ env.DEMYX_REPOSITORY }}:wp tag-wp | |
- name: Test | |
id: test | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
docker run -d --name=${{ env.DEMYX_REPOSITORY }} demyx/${{ env.DEMYX_REPOSITORY }} | |
DEMYX_TEST="$(docker exec ${{ env.DEMYX_REPOSITORY }} ${{ env.DEMYX_REPOSITORY }} --version 2>&1 | awk -F '[ ]' '{print $1}')" | |
if [[ "$DEMYX_TEST" =~ ^[0-9\.]+$ ]]; then | |
echo "$DEMYX_TEST" | |
else | |
exit 1 | |
fi | |
- name: Version | |
run: | | |
DEMYX_CODE_DEBIAN_VERSION="$(docker exec ${{ env.DEMYX_REPOSITORY }} cat /etc/debian_version)" | |
DEMYX_CODE_GO_VERSION="$(docker run --rm --entrypoint=go demyx/${{ env.DEMYX_REPOSITORY }}:go version | awk -F '[ ]' '{print $3}' | sed 's/go//g')" | |
DEMYX_CODE_VERSION="$(docker exec ${{ env.DEMYX_REPOSITORY }} code-server --version | awk -F '[ ]' '{print $1}')" | |
DEMYX_JQ="$(jq ".debian = \"$DEMYX_CODE_DEBIAN_VERSION\" | .go = \"$DEMYX_CODE_GO_VERSION\" | .code_server = \"$DEMYX_CODE_VERSION\"" version.json)" | |
# Update versions | |
echo "$DEMYX_JQ" > version.json | |
echo "DEMYX_CODE_DEBIAN_VERSION=$DEMYX_CODE_DEBIAN_VERSION | |
DEMYX_CODE_GO_VERSION=$DEMYX_CODE_GO_VERSION | |
DEMYX_CODE_VERSION=$DEMYX_CODE_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 }}:bedrock | |
docker push demyx/${{ env.DEMYX_REPOSITORY }}:browse | |
docker push demyx/${{ env.DEMYX_REPOSITORY }}:go | |
docker push demyx/${{ env.DEMYX_REPOSITORY }}:latest | |
docker push demyx/${{ env.DEMYX_REPOSITORY }}:openlitespeed | |
docker push demyx/${{ env.DEMYX_REPOSITORY }}:openlitespeed-bedrock | |
docker push demyx/${{ env.DEMYX_REPOSITORY }}:wp |