Skip to content

demyx/ssh

demyx/ssh #91

Workflow file for this run

name: demyx/ssh
on:
push:
branches:
- master
schedule:
- cron: '0 0 * * 6'
jobs:
master:
runs-on: ubuntu-latest
env:
DEMYX_REPOSITORY: ssh
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 build -t demyx/${{ env.DEMYX_REPOSITORY }} .
- name: Test
id: test
shell: 'script -q -e -c "bash {0}"'
run: |
docker run -d --rm --name=${{ env.DEMYX_REPOSITORY }} demyx/${{ env.DEMYX_REPOSITORY }}
DEMYX_TEST="$(docker exec ${{ env.DEMYX_REPOSITORY }} ssh -V 2>&1)"
if [[ "$DEMYX_TEST" == *"OpenSSH"* ]]; then
echo "$DEMYX_TEST"
else
exit 1
fi
- name: Version
run: |
DEMYX_SSH_ALPINE_VERSION="$(docker exec ${{ env.DEMYX_REPOSITORY }} cat /etc/os-release | grep VERSION_ID | cut -c 12-)"
DEMYX_SSH_OPENSSH_VERSION="$(docker exec ${{ env.DEMYX_REPOSITORY }} ssh -V 2>&1 | cut -c -13 | awk -F '[_]' '{print $2}')"
DEMYX_JQ="$(jq ".alpine = \"$DEMYX_SSH_ALPINE_VERSION\" | .ssh = \"$DEMYX_SSH_OPENSSH_VERSION\"" version.json)"
# Update versions
echo "$DEMYX_JQ" > version.json
echo "DEMYX_SSH_ALPINE_VERSION=$DEMYX_SSH_ALPINE_VERSION
DEMYX_SSH_OPENSSH_VERSION=$DEMYX_SSH_OPENSSH_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
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 "Schedule Build #${{ github.run_id }}"
git push
fi
docker push demyx/${{ env.DEMYX_REPOSITORY }}