set status update task to run at 5am #3
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
# Inspired from: https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images | |
name: Create and publish Docker image to GHCR | |
# Configures this workflow to run every time a change is pushed to the branch called `release`. | |
on: | |
workflow_dispatch: | |
push: | |
branches: ['main'] | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Uses the `docker/login-action` action to log in to the Github Container Registry | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# This step uses `docker/metadata-action` to extract tags and labels that will be applied to the specified image. | |
# The `id` "meta" allows the output of this step to be referenced in a subsequent step. | |
# The `images` value provides the base name for the tags and labels. | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/amfoss/amd | |
tags: | | |
# set latest tag for master branch | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }},priority=2000 | |
type=schedule,pattern={{date 'YYYYMMDD'}} | |
type=ref,event=tag | |
type=ref,event=pr | |
type=sha | |
# This step uses the `docker/build-push-action` action to build the image. If the build succeeds, it pushes the image to GitHub Packages. | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |