Update GitHub Actions workflows
This commit is contained in:
59
.github/workflows/build.yml
vendored
59
.github/workflows/build.yml
vendored
@ -2,32 +2,57 @@
|
|||||||
name: Test code, build Docker image, and push to Docker Hub and GitHub Container Registry.
|
name: Test code, build Docker image, and push to Docker Hub and GitHub Container Registry.
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 6 * * *"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
SERVE_DOMAIN: https://localhost/
|
SERVE_DOMAIN: https://localhost/
|
||||||
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
|
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
|
||||||
UPLOAD_FOLDER: ./Uploads
|
UPLOAD_FOLDER: ./Uploads
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: FedericoCarboni/setup-ffmpeg@v3
|
- uses: FedericoCarboni/setup-ffmpeg@v3
|
||||||
id: setup-ffmpeg
|
id: setup-ffmpeg
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: 3.13
|
||||||
- run: pipx install poetry
|
- uses: astral-sh/setup-uv@v5
|
||||||
- run: poetry install
|
with:
|
||||||
- run: poetry run pytest
|
version: "latest"
|
||||||
|
- run: uv sync --all-extras --all-groups
|
||||||
|
- run: uv run pytest
|
||||||
|
ruff:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: astral-sh/ruff-action@v3
|
||||||
|
with:
|
||||||
|
version: "latest"
|
||||||
|
- run: ruff check --exit-non-zero-on-fix --verbose
|
||||||
|
- run: ruff format --check --verbose
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
needs: [test, ruff]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: docker/setup-qemu-action@v3
|
||||||
|
with:
|
||||||
|
platforms: all
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
@ -41,19 +66,15 @@ jobs:
|
|||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Extract Docker metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
thelovinator/discord-nice-embed-maker-for-my-yoy
|
|
||||||
ghcr.io/thelovinator1/discord-embed
|
|
||||||
flavor: latest=${{ github.ref == 'refs/heads/master' }}
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: build-and-push
|
id: build-and-push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
platforms: linux/amd64, linux/arm64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: |
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
ghcr.io/thelovinator1/discord-embed:latest
|
||||||
|
ghcr.io/thelovinator1/discord-embed:master
|
||||||
|
thelovinator/discord-nice-embed-maker-for-my-yoy:latest
|
||||||
|
thelovinator/discord-nice-embed-maker-for-my-yoy:master
|
||||||
|
14
.github/workflows/ruff.yml
vendored
14
.github/workflows/ruff.yml
vendored
@ -1,14 +0,0 @@
|
|||||||
name: Ruff
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 0 * * *' # Run every day
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ruff:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: chartboost/ruff-action@v1
|
|
Reference in New Issue
Block a user