refactor(ui): Replace base64 assets by image #27
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: Build | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: [src/**/*, main.py, requirements.txt, Dockerfile] | |
env: | |
PR_NUMBER: pr${{ github.event.number }} | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: chartboost/ruff-action@v1 | |
name: Show what fixes will be applied | |
with: | |
src: "./src main.py" | |
version: 0.2.1 | |
args: --diff --exit-zero | |
- uses: chartboost/ruff-action@v1 | |
name: Appy fixes | |
with: | |
src: "./src main.py" | |
version: 0.2.1 | |
args: --fix --show-fixes | |
- name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.GH_ACTIONS_BOT_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GH_ACTIONS_BOT_GPG_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_options: '-s -S' | |
commit_message: Commit lint fixes | |
commit_user_name: github-actions[bot] | |
commit_user_email: [email protected] | |
commit_author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> | |
build: | |
name: Build Docker images | |
runs-on: ubuntu-latest | |
needs: [lint] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: | | |
${{ github.repository }} | |
ghcr.io/${{ github.repository }} | |
tags: | | |
type=raw,value=${{ env.PR_NUMBER }} | |
type=raw,value=latest | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
outputs: type=docker,dest=/tmp/${{ github.event.repository.name }}-${{ env.PR_NUMBER }}.tar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.event.repository.name }}-${{ env.PR_NUMBER }} | |
path: /tmp/${{ github.event.repository.name }}-${{ env.PR_NUMBER }}.tar | |
scan: | |
name: Scan Docker images | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ github.event.repository.name }}-${{ env.PR_NUMBER }} | |
path: /tmp | |
- name: Load image | |
run: | | |
docker load --input /tmp/${{ github.event.repository.name }}-${{ env.PR_NUMBER }}.tar | |
- name: Find vulnerabilities | |
run: | | |
docker run -v /var/run/docker.sock:/var/run/docker.sock \ | |
anchore/grype:v0.72.0 docker:${{ github.repository }}:${{ env.PR_NUMBER }} -o table --fail-on critical |