mirror of
https://github.com/joaovitoriasilva/endurain.git
synced 2026-05-03 03:00:41 -04:00
Replace Docker workflows; add publish and docs
Remove two legacy workflows (docker-image_latest_manual.yml and docker-image_manualORnewrelease.yml) and introduce a consolidated docker-publish.yml that builds and pushes multi-arch Docker images to ghcr.io. The new workflow uses updated actions (checkout@v4, setup-qemu@v3, setup-buildx@v3, docker/login-action, docker/metadata-action and docker/build-push-action), adds permissions, concurrency, caching, and improved tagging (semver, latest on release, dev-<sha> on manual runs). Also add docs.yml to deploy MkDocs documentation to GitHub Pages on pushes to master that touch docs, mkdocs.yml, or backend Python files; it sets up Python 3.13 and installs mkdocs-material and mkdocstrings. Overall this modernizes CI, consolidates Docker publishing, and adds automated docs deployment.
This commit is contained in:
37
.github/workflows/docker-image_latest_manual.yml
vendored
37
.github/workflows/docker-image_latest_manual.yml
vendored
@@ -1,37 +0,0 @@
|
||||
name: Create Docker image with latest tag on manual trigger
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Create a builder
|
||||
run: |
|
||||
docker buildx create --use
|
||||
|
||||
- name: Build and push the Docker image
|
||||
run: |
|
||||
IMAGE_TAG="latest"
|
||||
IMAGE_NAME="ghcr.io/${{ github.repository }}"
|
||||
|
||||
echo ${{ secrets.TOKEN_FOR_ACTIONS }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
|
||||
|
||||
docker buildx build --platform linux/amd64,linux/arm64 --file docker/Dockerfile --tag $IMAGE_NAME:$IMAGE_TAG --push .
|
||||
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
|
||||
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
|
||||
@@ -1,44 +0,0 @@
|
||||
name: Create Docker image on new release or using manual trigger
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Create a builder
|
||||
run: |
|
||||
docker buildx create --use
|
||||
|
||||
- name: Build and push the Docker image
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == 'workflow_dispatch' ]; then
|
||||
IMAGE_TAG="dev_$(date +"%d%m%Y")"
|
||||
else
|
||||
IMAGE_TAG="${{ github.event.release.tag_name }}"
|
||||
fi
|
||||
IMAGE_NAME="ghcr.io/${{ github.repository }}"
|
||||
|
||||
echo ${{ secrets.TOKEN_FOR_ACTIONS }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
|
||||
|
||||
docker buildx build --platform linux/amd64,linux/arm64 --file docker/Dockerfile --tag $IMAGE_NAME:$IMAGE_TAG --push .
|
||||
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
|
||||
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
|
||||
64
.github/workflows/docker-publish.yml
vendored
Normal file
64
.github/workflows/docker-publish.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
name: Create Docker image on new release or using manual trigger
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.TOKEN_FOR_ACTIONS }}
|
||||
|
||||
- name: Extract image metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}
|
||||
tags: |
|
||||
type=semver,pattern={{raw}}
|
||||
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
|
||||
type=raw,value=dev-{{sha}},enable=${{ github.event_name == 'workflow_dispatch' }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
41
.github/workflows/docs.yml
vendored
Normal file
41
.github/workflows/docs.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Deploy documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- 'mkdocs.yml'
|
||||
- 'backend/app/**/*.py'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
deploy:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.13'
|
||||
cache: pip
|
||||
|
||||
- name: Install documentation dependencies
|
||||
run: pip install --no-cache-dir mkdocs-material mkdocstrings[python]
|
||||
|
||||
- name: Deploy documentation to GitHub Pages
|
||||
run: mkdocs gh-deploy --force
|
||||
Reference in New Issue
Block a user