Skip to content

Check for updates

Check for updates #308

Workflow file for this run

name: Check for updates
on:
repository_dispatch:
types: check
schedule:
# every 3 days
- cron: 0 0 * * 3
jobs:
check:
runs-on: ubuntu-latest
strategy:
matrix:
package:
- chromium
- chromium-headful
steps:
- name: Checkout
uses: actions/checkout@v2
# https://github.com/actions/checkout#Fetch-all-tags
- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Get version
id: get_version
run: echo ::set-output name=result::$(make --file ${{ matrix.package }}/Makefile get-version)
- name: Check status
id: check_status
run: echo ::set-output name=result::$(git tag | grep --quiet chromium@${{ steps.get_version.outputs.result }} && echo 'up-to-date' || echo 'outdated')
- name: Print results
run: |
echo package: ${{ matrix.package }}
echo version: ${{ steps.get_version.outputs.result }}
echo status: ${{ steps.check_status.outputs.result }}
- name: Build image
if: steps.check_status.outputs.result == 'outdated'
run: make --file ${{ matrix.package }}/Makefile build version=${{ steps.get_version.outputs.result }}
- name: Test
if: steps.check_status.outputs.result == 'outdated'
run: make --file ${{ matrix.package }}/Makefile test
- name: Get image size
id: get_size
if: steps.check_status.outputs.result == 'outdated'
run: |
docker save ${{ matrix.package }} | gzip > ${{ matrix.package }}.tar.gz
echo ::set-output name=result::$(du --human-readable --apparent-size ${{ matrix.package }}.tar.gz | cut --fields=1)
rm ${{ matrix.package }}.tar.gz
- name: Git setup
if: steps.check_status.outputs.result == 'outdated'
run: |
git config --global user.name 'GitHub'
git config --global user.email '[email protected]'
git remote set-url origin https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git
- name: Git pull
if: steps.check_status.outputs.result == 'outdated'
run: git pull origin master
- name: Update readme
if: steps.check_status.outputs.result == 'outdated'
run: |
sed --regexp-extended --in-place 's/version\/[[:alnum:].]+\/blue/version\/'${{ steps.get_version.outputs.result }}'\/blue/' ${{ matrix.package }}/readme.md
sed --regexp-extended --in-place 's/size\/[[:alnum:].]+\/blue/size\/'${{ steps.get_size.outputs.result }}'\/blue/' ${{ matrix.package }}/readme.md
- name: Git commit
if: steps.check_status.outputs.result == 'outdated'
run: git commit --message '♻️ ${{ matrix.package }}@${{ steps.get_version.outputs.result }}' ${{ matrix.package }}/readme.md
- name: Make Docker and Git tags
if: steps.check_status.outputs.result == 'outdated'
run: make --file ${{ matrix.package }}/Makefile tags version=${{ steps.get_version.outputs.result }}
- name: Git push
if: steps.check_status.outputs.result == 'outdated'
run: git push --force --tags origin master
- name: Login into Docker
if: steps.check_status.outputs.result == 'outdated'
run: docker login --username=anatol1988 --password=${{ secrets.DOCKER_TOKEN }}
- name: Push image to Docker
if: steps.check_status.outputs.result == 'outdated'
run: docker push neuralegion/nextools-${{ matrix.package }}