Skip to content

trying to fix the deploy workflow (this process is annoying) #38

trying to fix the deploy workflow (this process is annoying)

trying to fix the deploy workflow (this process is annoying) #38

name: Build Container
on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
workflow_dispatch:
inputs:
someParameter:
description: "Optional parameter"
required: false
jobs:
check-updates:
runs-on: ubuntu-latest
outputs:
updated: ${{ steps.check.outputs.updated }}
steps:
- name: Check for updates in sminghub/sming
id: check
run: |
latest_commit=$(curl -s "https://api.github.com/repos/SmingHub/Sming/commits/develop" | jq -r '.commit.committer.date')
latest_commit_date=$(date -d "$latest_commit" +%s)
current_date=$(date +%s)
difference=$(( (current_date - latest_commit_date) / 86400 ))
if [ $difference -le 1 ]; then
echo "updated=true" >> $GITHUB_OUTPUT
else
echo "updated=false" >> $GITHUB_OUTPUT
fi
build:
runs-on: ubuntu-latest
needs: check-updates
if: needs.check-updates.outputs.updated == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: docker/Dockerfile
push: true
tags: pjakobs/sming:latest