[pre-commit.ci] pre-commit autoupdate (#139) #273
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: Test code, build Docker image, and push to Docker Hub and GitHub Container Registry. | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
env: | |
SERVE_DOMAIN: https://localhost/ | |
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }} | |
UPLOAD_FOLDER: ./Uploads | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: FedericoCarboni/setup-ffmpeg@v2 | |
id: setup-ffmpeg | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- run: pipx install poetry | |
- run: poetry install | |
- run: poetry run pytest | |
- name: Login to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
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 | |
id: build-and-push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |