1+ name : Nightly Build and Push
2+ # This workflow builds and pushes a Docker image to GitHub Container Registry
3+ # and optionally to Docker Hub.
4+ # It runs nightly at 2 AM UTC and can also be triggered manually.
5+ # The image is tagged with "nightly" and the repository owner is converted to lowercase.
6+ # The workflow uses the GITHUB_TOKEN secret for authentication with GitHub Container Registry.
7+ # Uncomment the Docker Hub section if you want to push to Docker Hub as well.
8+ # The Docker Hub credentials should be stored in the repository secrets as DOCKER_USERNAME and DOCKER_PASSWORD.
9+ # The workflow is triggered on a schedule and can also be run manually.
10+
11+ on :
12+ schedule : # runs on the default branch: master
13+ - cron : " 0 2 * * *" # run at 2 AM UTC
14+ workflow_dispatch : # allows manual triggering of the workflow
15+
16+ jobs :
17+ publish_image :
18+ runs-on : ubuntu-latest
19+ steps :
20+ - name : Checkout
21+ uses : actions/checkout@v4
22+
23+ - name : Convert repository owner to lowercase
24+ run : echo "owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
25+
26+ - name : Build image
27+ run : docker build -t ghcr.io/${{ env.owner }}/eos_connect:nightly .
28+
29+ - name : Log in to GitHub Container Registry
30+ run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
31+
32+ - name : Push Docker image to GitHub Container Registry
33+ run : docker push ghcr.io/${{ env.owner }}/eos_connect:nightly
34+
35+ # - name: Log in to Docker Hub
36+ # run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
37+ # - name: Push image to Docker Hub
38+ # run: docker push ${{ secrets.DOCKER_USERNAME }}/eos_connect:nightly
0 commit comments