mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2026-09-24 14:20:08 +01:00
* use camoufox * build custom branches * organize compose * ignore missing stubs * add init method * create ADDON PATH * check if solving is required * type checking and remove logger * uv sync * add timeout * add descriptiuon * cancel previous runs * wildcard minor * fix proxy * syntax fix * [skip ci] fix loop warning * fix proxy format * copy over docker ignore * remove testing line * comment out port expose * remove idope * use strict typechecking * refactor * adjust compose * run init only before test * try test without init * add curl * handle page response * remove turnsile test * fix dockerignore symlink * use newer debian * bump pytest * add docker in docker in devcontaienr * remove unused values * handle timeouts * fix edgecase * use new envs for proxy * remove init command * remove testing line * remove setuptools * fix linters * reimport * readd setuptools * better float handling
193 lines
5.1 KiB
YAML
193 lines
5.1 KiB
YAML
name: Docker
|
|
|
|
# This workflow uses actions that are not certified by GitHub.
|
|
# They are provided by a third-party and are governed by
|
|
# separate terms of service, privacy policy, and support
|
|
# documentation.
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "25 0 * * *"
|
|
push:
|
|
branches: ["*"]
|
|
# Publish semver tags as releases.
|
|
tags: ["v*.*.*"]
|
|
pull_request:
|
|
branches: ["main"]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
# Use docker.io for Docker Hub if empty
|
|
REGISTRY: ghcr.io
|
|
# github.repository as <account>/<repo>
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Test
|
|
id: test
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
cache-from: type=gha,scope=x64
|
|
pull: true
|
|
cache-to: type=gha,mode=max,scope=x64
|
|
target: test
|
|
|
|
build:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
id-token: write
|
|
|
|
strategy:
|
|
matrix:
|
|
platform: [linux/amd64, linux/arm64]
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Prepare variables
|
|
id: vars
|
|
run: |
|
|
SURFIX=$(echo ${{ matrix.platform }} | cut -d'/' -f2)
|
|
echo "SURFIX=$SURFIX" >> $GITHUB_OUTPUT
|
|
# Generate a unique local tag for the image
|
|
echo "LOCAL_TAG=${{ github.sha }}-$SURFIX" >> $GITHUB_OUTPUT
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
# Set up BuildKit Docker container builder
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
# Log into registry
|
|
- name: Log into registry ${{ env.REGISTRY }}
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# Extract metadata (tags, labels) for Docker
|
|
- name: Extract Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
tags: type=raw,value=${{ steps.vars.outputs.LOCAL_TAG }}
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
# Build and export Docker image for each platform (without pushing)
|
|
- name: Build Docker image
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
pull: true
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: ${{ matrix.platform }}
|
|
cache-from: type=gha,scope=${{ matrix.platform }}
|
|
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
|
|
build-args: |
|
|
GITHUB_BUILD=true
|
|
VERSION=${{ github.ref_type == 'tag' && github.ref_name || github.sha }}
|
|
|
|
merge-and-push:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name != 'pull_request'
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v5
|
|
|
|
# Install the cosign tool
|
|
- name: Install cosign
|
|
uses: sigstore/cosign-installer@v3
|
|
|
|
# Set up Docker Buildx
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
# Log into registry
|
|
- name: Log into registry ${{ env.REGISTRY }}
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# Extract Docker metadata for tagging
|
|
- name: Extract Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
# Create manifest lists and push
|
|
- name: Create and push manifest lists
|
|
run: |
|
|
TAGS="${{ steps.meta.outputs.tags }}"
|
|
args=""
|
|
|
|
image=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
image=${image,,}
|
|
|
|
# Create tag arguments
|
|
for tag in $TAGS; do
|
|
args="$args -t $tag"
|
|
done
|
|
|
|
if [ "${{ github.ref_type }}" == "tag" ]; then
|
|
args="$args -t ${image}:latest"
|
|
fi
|
|
|
|
echo $args
|
|
|
|
docker buildx imagetools create $args \
|
|
${image}:${{github.sha}}-amd64 \
|
|
${image}:${{github.sha}}-arm64
|
|
|
|
# Sign the manifest
|
|
- name: Sign the manifests
|
|
env:
|
|
TAGS: ${{ steps.meta.outputs.tags }}
|
|
run: |
|
|
for TAG in $TAGS; do
|
|
cosign sign --yes $TAG
|
|
done
|