Skip to content

Build and Tag Image #81

Build and Tag Image

Build and Tag Image #81

Workflow file for this run

name: Build and Tag Image
on:
push:
branches:
- main
schedule:
- cron: "0 0 * * *" # once every 24 hours (UTC)
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
pull-requests: write
repository-projects: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set timestamp tag
id: tag
run: |
TAG=$(date +"%Y%m%d_%H%M%S")
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: |
IMAGE=ghcr.io/stratos-linux/stratos-base
docker build \
-t $IMAGE:${TAG} \
-t $IMAGE:latest \
.
# ghcr.io/${{ github.repository }}
- name: Push Docker image
run: |
IMAGE=ghcr.io/stratos-linux/stratos-base
docker push $IMAGE:${TAG}
docker push $IMAGE:latest