Adopt project linters #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- ".gitignore" | |
- "LICENSE.md" | |
- "README.md" | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- ".gitignore" | |
- "LICENSE.md" | |
- "README.md" | |
workflow_dispatch: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Lint Dockerfiles | |
run: | | |
wget -O hadolint https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64 | |
mv hadolint /usr/local/bin/hadolint | |
chmod +x /usr/local/bin/hadolint | |
ls -la | |
hadolint --config .hadolint.yaml ./Dockerfiles/* | |
build: | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- dockerfile: ./Dockerfiles/Dockerfile.drgon-postgres | |
image: ghcr.io/${{ github.repository }} | |
tag: postgres | |
- dockerfile: ./Dockerfiles/Dockerfile.drgon-server | |
image: ghcr.io/${{ github.repository }} | |
tag: server | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
type=sha,prefix=${{ matrix.tag }}- | |
type=raw,value=${{ matrix.tag }} | |
- name: Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: geovanni-bot | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push image | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
context: . | |
file: ${{ matrix.dockerfile }} | |
push: true | |
tags: ${{ steps.docker_meta.outputs.tags }} |