ci: build and push docker image to github container repo

pull/4/head
Cameron Clough 2022-03-26 16:20:28 +00:00
parent 4c419d7b56
commit cef7e58239
No known key found for this signature in database
GPG Key ID: BFB3B74B026ED43F
1 changed files with 40 additions and 16 deletions

View File

@ -8,21 +8,45 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: docker build -t retropilot-server:latest .
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/RetroPilot/retropilot-server
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: Login to GHCR
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 }}
lint:
name: Run linter
runs-on: ubuntu-20.04
needs: docker
steps:
- name: Run linter
run: docker run --rm retropilot-server:latest npm run lint
# lint:
# name: Run linter
# runs-on: ubuntu-20.04
# needs: docker
# steps:
# - name: Run linter
# run: docker run --rm retropilot-server:latest npm run lint
test:
name: Run tests
runs-on: ubuntu-20.04
needs: docker
steps:
- name: Run tests
run: docker run --rm --env-file .env.sample -v /tmp/realdata:/app/realdata retropilot-server:latest npm test
# test:
# name: Run tests
# runs-on: ubuntu-20.04
# needs: docker
# steps:
# - name: Run tests
# run: docker run --rm --env-file .env.sample -v /tmp/realdata:/app/realdata retropilot-server:latest npm test