Skip to content

Commit

Permalink
ci: build an edge (master-branch) image too
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Sep 7, 2024
1 parent 5839f88 commit bceb4b5
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
release:
types: [published]

push:
branches:
- master

jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -12,26 +16,52 @@ jobs:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5

- name: Set up master (edge) image metadata
id: meta-master
uses: docker/metadata-action@v5
if: ${{ github.event_name != 'release' }}
with:
python-version: '3.11'
- run: pip install poetry && poetry update && poetry export -f requirements.txt > requirements.txt
- uses: docker/metadata-action@v5
id: meta
images: |
${{ inputs.image-name }}
flavor: |
latest=false
tags: |
type=raw,value=master,enable={{is_default_branch}}
type=sha,prefix=sha-
- name: Set up release image metadata
id: meta-release
uses: docker/metadata-action@v5
if: ${{ github.event_name == 'release' }}
with:
images: ghcr.io/idoneam/Canary
flavor: |
latest=true
tags: |
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push master (edge) image
uses: docker/build-push-action@v6
if: ${{ github.event_name != 'release' }}
with:
context: .
push: true
tags: ${{ steps.meta-master.outputs.tags }}

- uses: docker/build-push-action@v6
if: ${{ github.event_name == 'release' }}
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
tags: ${{ steps.meta-release.outputs.tags }}

0 comments on commit bceb4b5

Please sign in to comment.