Skip to content

Commit

Permalink
Publish container to GHCR
Browse files Browse the repository at this point in the history
  • Loading branch information
credbbl committed Dec 8, 2023
1 parent 01e3839 commit db60a2d
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
permissions:
# Checkout repository
contents: read
# Push container images
packages: write

jobs:
build:
Expand All @@ -30,7 +32,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build image
- name: Build image for tests
id: build
uses: docker/build-push-action@v5
with:
Expand Down Expand Up @@ -71,3 +73,34 @@ jobs:
--workdir /usr/local/src
${{ steps.build.outputs.imageid }}
/bin/sh -c 'apt-get install -y mypy python3-pytest && mypy --show-error-codes .'
- name: Docker meta
id: meta
if: ${{ github.event_name != 'pull_request' || always() }}
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=edge
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' || always() }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image
if: ${{ github.event_name != 'pull_request' || always() }}
uses: docker/build-push-action@v5
with:
file: Containerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit db60a2d

Please sign in to comment.