Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Check for new Go Chromecast version #59

Check for new Go Chromecast version

Check for new Go Chromecast version #59

name: Check for new Go Chromecast version
on:
schedule:
- cron: "0 0 * * *" # Schedule to run once every day
jobs:
build-multi-arch-image:
name: Build multi-arch Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get current go-chromecast version from Dockerfile
id: get-current-version
run: |
CURRENT_CHROMECASTGOVERSION=$(grep -oP '(?<=CHROMECASTGOVERSION=).*' ./Dockerfile)
echo "CURRENT_CHROMECASTGOVERSION=$CURRENT_CHROMECASTGOVERSION" >> $GITHUB_ENV
- name: Get latest go-chromecast version
id: get-latest-version
run: |
LATEST_VERSION=$(curl -s "https://api.github.com/repos/vishen/go-chromecast/releases/latest" | jq -r '.tag_name')
echo "LATEST_CHROMECASTGOVERSION=$LATEST_VERSION" >> $GITHUB_ENV
- name: Check if version is newer and update Dockerfile
id: check-version-and-update-dockerfile
run: |
if [[ "${{ env.CURRENT_CHROMECASTGOVERSION }}" == "${{ env.LATEST_CHROMECASTGOVERSION }}" ]]; then
echo "No new version available. Skipping Dockerfile update."
echo "VERSION_CHANGED=false" >> $GITHUB_ENV
else
echo "New version available. Updating Dockerfile."
echo "VERSION_CHANGED=true" >> $GITHUB_ENV
sed -i "s/ENV CHROMECASTGOVERSION=.*/ENV CHROMECASTGOVERSION=${{ env.LATEST_CHROMECASTGOVERSION }}/" ./Dockerfile
fi
- name: Set up QEMU
uses: docker/[email protected]
if: ${{ env.VERSION_CHANGED == 'true' }}
- name: Set up Docker Buildx
uses: docker/[email protected]
with:
install: true
if: ${{ env.VERSION_CHANGED == 'true' }}
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
if: ${{ env.VERSION_CHANGED == 'true' }}
- name: Build and push
uses: docker/[email protected]
with:
push: true
context: .
tags: ghcr.io/${{ github.repository }}:latest
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6
file: ./Dockerfile
if: ${{ env.VERSION_CHANGED == 'true' }}