Build and publish image to ghcr.io/epics-containers #14
Workflow file for this run
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: Build and publish image to ghcr.io/epics-containers | |
on: | |
push: | |
pull_request: | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Determine container image tag to use | |
id: tag | |
run: | | |
# tag is branch name or tag if there is a tag | |
echo ::set-output name=image_tag::${GITHUB_REF##*/} | |
echo ::set-output name=do_push::true | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Log in to GitHub Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io/epics-containers | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build developer image | |
uses: docker/build-push-action@v5 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
push: ${{ steps.tag.outputs.do_push }} | |
tags: | | |
ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.image_tag }} | |
# - name: Build runtime image | |
# uses: docker/build-push-action@v5 | |
# with: | |
# builder: ${{ steps.buildx.outputs.name }} | |
# push: ${{ steps.tag.outputs.do_push }} | |
# tags: | | |
# ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.image_tag }}.run | |
# target: runtime | |
# cache-from: type=local,src=/tmp/.buildx-cache | |
# cache-to: type=local,dest=/tmp/.buildx-cache | |