Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
ci(github-action): build a nightly docker image and push to Github …
Browse files Browse the repository at this point in the history
…Container Registry

  ## what
  - Build a `nightly` docker image
  - Push docker image to Github Container Registry only when running on `development` branch

  ## how
  - Build docker image and use tag `nightly`
  - change Label for `org.opencontainers.image.version` to `nightly`

  ## why
  - check issue #310

  ## where
  - .github/workflows/build.yaml

  ## usage
  • Loading branch information
Clumsy-Coder committed Jul 29, 2023
1 parent 3cebfd4 commit 6cbe629
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,36 @@ jobs:
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.version=${{ env.NEXT_VERSION }}
# adding a duplicate run for building docker image is because,
# the nightly build will have a different value for the label `org.opencontainers.image.version`
- name: Build `nightly` docker image
uses: docker/build-push-action@v3
with:
context: .
file: ./dockerfile
pull: true
load: true
tags: |
${{ env.GHCR_IMAGE }}:nightly
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
labels: |
org.opencontainers.image.authors=${{ github.repository_owner }}
org.opencontainers.image.created=${{ env.BUILD_DATE }}
org.opencontainers.image.description=Created from commit ${{ env.GIT_SHA }} and ref ${{ env.GIT_REF }}
org.opencontainers.image.ref.name=${{ env.GIT_REF }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.version=nightly
- name: View current docker images
run: docker images

- name: Push `nightly` Docker image to Github Container Registry
if: github.ref == 'refs/heads/development'
run: docker push ${{ env.GHCR_IMAGE }}:nightly

- name: Push Docker images to GitHub Container Registry
# only push if on master branch AND there's a new version to push
if: steps.get-next-version.outputs.new-release-published == 'true'
Expand Down

0 comments on commit 6cbe629

Please sign in to comment.