Skip to content

Commit

Permalink
add Docker build release action
Browse files Browse the repository at this point in the history
  • Loading branch information
j2salmingo committed Nov 12, 2024
1 parent cb6bc0b commit e459993
Showing 1 changed file with 21 additions and 41 deletions.
62 changes: 21 additions & 41 deletions .github/workflows/Docker-build-release.yaml
Original file line number Diff line number Diff line change
@@ -1,53 +1,33 @@
---
name: Docker-build-release
name: Update image in GHCR

run-name: >
${{
github.event_name == 'delete' && format(
'Delete `{0}{1}`',
github.event.ref_type == 'branch' && 'branch-' || '',
github.event.ref
)
|| github.ref == 'refs/heads/main' && 'Update `dev`'
|| format(
'Update `{0}{1}`',
!startsWith(github.ref, 'refs/tags') && 'branch-' || '',
github.ref_name
)
}} docker tag
on:
push:
branches: ['main']
branches-ignore: ['gh-pages']
tags: ['v*']
release:
types: [published]
delete:

jobs:
build-and-push-image:
push-or-delete-image:
runs-on: ubuntu-latest
name: A job to build and push a docker image
name: Update GitHub Container Registry
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Read YAML
id: yaml-data
uses: jbutcher5/[email protected]
with:
file: metadata.yaml
key-path: '["image_name"]'

- name: Create tags
id: meta
uses: docker/metadata-action@v3
with:
flavor: |
latest=false
images: ghcr.io/uclahs-cds/${{ steps.yaml-data.outputs.data }}
tags: |
type=raw,enable=${{github.event_name == 'push'}},value=dev,event=branch
type=match,pattern=v(.*),group=1
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io/uclahs-cds
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
file: ./docker/Dockerfile
- uses: uclahs-cds/tool-Docker-action@v2

0 comments on commit e459993

Please sign in to comment.