Skip to content

Fix/vault token reneval (#13) #2

Fix/vault token reneval (#13)

Fix/vault token reneval (#13) #2

name: Upload Jobs Image to Registry
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_IMAGE_NAME: jobs
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'ewc/jobs/Dockerfile'
- 'ewc/jobs/*.sh'
- '.github/workflows/upload_jobs_image.yml'
jobs:
build-and-push-docker-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Add Docker metadata to the image
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/${{ env.DOCKER_IMAGE_NAME }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule,pattern={{date 'YYYYMMDD-HHmmss'}}
type=sha
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
file: ./ewc/jobs/Dockerfile
context: ./ewc/jobs
platforms: linux/amd64
push: true
# for now cache to github actions
# might need some tuning
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}