Docker image and CI

This commit is contained in:
Quentin Gliech
2021-09-17 10:40:08 +02:00
parent bade8cd8bf
commit bc07a0d968
3 changed files with 67 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
name: Check
name: CI
on:
push:
@@ -220,3 +220,46 @@ jobs:
with:
command: test
args: --offline
build-image:
name: Build and push Docker image
needs: [rustfmt, clippy]
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/matrix-org/matrix-authentication-service
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max