Update Images #184
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Images | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ latest ] | |
pull_request: | |
branches: [ latest ] | |
schedule: | |
- cron: '0 0 * * *' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
repository_dispatch: | |
types: | |
- webhook | |
jobs: | |
builder: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
with: | |
install: true | |
- name: Docker Login | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ghcr.io/${{ github.repository_owner }}/gha/runner | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=schedule,pattern=latest | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Build Image | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./ | |
file: Dockerfile | |
push: true | |
pull: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
builder: ${{ steps.buildx.outputs.name }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |