Skip to content

Site update

Site update #716

Workflow file for this run

name: Docker Image CI
on:
push:
tags:
- 'release-*' # Only trigger on tags that start with 'release-'
branches:
- "main"
- "local"
pull_request:
branches:
- "main"
- "local"
jobs:
build-and-push:
if: startsWith(github.ref, 'refs/tags/release-')
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USER_NAME }}" --password-stdin
- name: Build and tag the Docker image
id: build
run: |
TIMESTAMP=$(date +%s)
echo "TIMESTAMP=$TIMESTAMP" >> $GITHUB_ENV
# Define the default tags for the main branch
TAGS="${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:latest"
ADDITIONAL_TAG="${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:$TIMESTAMP"
# If the branch is 'local', modify the tags
if [ "${{ github.ref }}" == "refs/heads/local" ]; then
TAGS="${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:local"
ADDITIONAL_TAG="${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:$TIMESTAMP-local"
fi
# Build the Docker image with the appropriate tags
docker build . --file Mostlylucid/Dockerfile --tag $TAGS --tag $ADDITIONAL_TAG
- name: Push the Docker image to Docker Hub
run: |
# Push the appropriate tags based on the branch
if [ "${{ github.ref }}" == "refs/heads/local" ]; then
docker push ${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:local
docker push ${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:${{ env.TIMESTAMP }}-local
else
docker push ${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:latest
docker push ${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:${{ env.TIMESTAMP }}
fi