Get latest alpine release #363
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: Get latest alpine release | |
on: | |
push: | |
#branches: | |
# - main | |
paths: | |
# Run when file is edited | |
- .github/workflows/get-latest-alpine-release.yml | |
schedule: | |
- cron: '0 9 * * *' | |
workflow_dispatch: | |
jobs: | |
get-alpine-release-date: | |
runs-on: ubuntu-latest | |
steps: | |
# Login to docker is not nessasary for lucacome/[email protected] | |
# - name: Login to Docker Hub | |
# uses: docker/login-action@v2 | |
# with: | |
# username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Docker Image Update Checker | |
id: check | |
# uses: lucacome/[email protected] | |
uses: clowa/docker-image-update-checker@342608bb9829d85eeeeb292e78115184b5a6657d | |
with: | |
base-image: library/alpine:latest | |
# The library is a keyword used by docker offical images and fixes https://github.com/lucacome/docker-image-update-checker/issues/31 | |
image: zinen2/alpine-pigpiod:latest | |
# Platforms with variants removed due to issue https://github.com/lucacome/docker-image-update-checker/issues/27 | |
platforms: linux/arm/v6,linux/arm/v7,linux/arm64 | |
# platforms: linux/arm64 | |
# env: | |
# DEBUG: true | |
push-alpine-release-date: | |
needs: get-alpine-release-date | |
if: needs.check.outputs.needs-updating == 'true' || github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
# Use PAT so allow this action to trigger a new action | |
token: ${{ secrets.PAT }} | |
- name: Check result | |
run: | | |
echo "Needs updating: ${{ steps.check.outputs.needs-updating }}" | |
CURRENT_TIME=$( date ) | |
echo Checked time $CURRENT_TIME | |
# Save the current checked time to a file in folder(folder must be there before) | |
echo Checked time $CURRENT_TIME > release-versions/alpine-new-release.txt | |
cat release-versions/alpine-new-release.txt | |
- name: Push changes | |
# This needs actions/checkout to be able push to repo | |
run: | | |
git config user.name "bot_${{ github.event_name }}" | |
git config user.email "bot_${{ github.event_name }}@users.noreply.github.com" | |
# Add all files to commit in current and sub folders | |
git add . | |
# Check if something changed and then commit | |
git diff --quiet HEAD || git commit -m "Auto. A ${{ github.event_name }} added this" | |
git push | |
check-docker-scout: | |
needs: get-alpine-release-date | |
if: needs.check.outputs.needs-updating != 'true' || github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
steps: | |
# Login to docker is required to access the scout feature | |
- name: Authenticate to Docker | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
# Compare the image built in the pull request with the one in production | |
- name: Docker Scout | |
id: docker-scout | |
#if: ${{ github.event_name == 'pull_request' }} | |
uses: docker/scout-action@v1 | |
with: | |
command: quickview,cves #compare | |
image: zinen2/alpine-pigpiod:latest | |
#to-env: production | |
ignore-unchanged: true | |
only-severities: critical,high | |
#token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
platform: linux/arm/v7 | |
debug: true |