Skip to content

Merge pull request #38 from srobo/feature/mentionable #130

Merge pull request #38 from srobo/feature/mentionable

Merge pull request #38 from srobo/feature/mentionable #130

Workflow file for this run

name: Validate, Build & maybe Deploy
on:
push:
branches:
- main
pull_request: {}
jobs:
run-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Cache dependencies
uses: actions/cache@v3
id: cache-dep
with:
path: venv
key: deps-1-${{ hashfiles('script/requirements.txt') }}
- name: Install Dependencies
run: |
python3 -m venv venv
venv/bin/pip install -U pip wheel
venv/bin/pip install -r script/requirements.txt
venv/bin/pip install .
- name: Lint with flake8
run: |
source venv/bin/activate
./script/linting/lint
- name: Typecheck with Mypy
if: ${{ always() }}
run: |
source venv/bin/activate
./script/typing/check
validate-requirements:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Cache dependencies
uses: actions/cache@v3
id: cache-dep
with:
path: venv
key: deps-1-${{ hashfiles('script/requirements.txt') }}
- name: Install Dependencies
run: |
python3 -m venv venv
venv/bin/pip install -U pip wheel
venv/bin/pip install -r script/requirements.txt
- name: Check main dependencies
run: |
source venv/bin/activate
pip-compile && git diff --exit-code
- name: Check development dependencies
if: ${{ always() }}
run: |
source venv/bin/activate
pip-compile script/requirements.in && git diff --exit-code
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs:
- run-checks
- validate-requirements
steps:
- name: Log in to the Container registry
uses: docker/[email protected]
if: ${{ github.ref == 'refs/heads/main' }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & maybe Push Container
uses: docker/build-push-action@v2
id: docker_build
with:
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/srobo/discord-gated-entry:build-${{ github.run_number }}
ghcr.io/srobo/discord-gated-entry:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}