Skip to content

Docker Image CI

Docker Image CI #126

Workflow file for this run

name: Docker Image CI
on:
push:
branches:
- "master"
pull_request:
branches:
- "master"
schedule:
- cron: '0 5 * * 0' # This will run the workflow every Sunday at 5 am
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get the commit ID
id: get_commit
run: echo "commit=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Inject version and commit ID into index.ejs
run: |
COMMIT=${{ env.commit }}
echo "<!-- Version: HEAD, Commit ID: $COMMIT -->" >> views/index.ejs
grep "<!-- Version: HEAD, Commit ID: $COMMIT -->" views/index.ejs || exit 1
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
wemove/read2burn
tags: |
type=raw,value=latest
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
file: docker/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}