mirror of
https://github.com/TeamPGM/PagerMaid-Pyro.git
synced 2024-11-21 14:18:21 +00:00
👷 CI: support gitea
This commit is contained in:
parent
b0a807b82c
commit
895ca3ca9d
42
.gitea/workflows/docker.yml
Normal file
42
.gitea/workflows/docker.yml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: "Docker Build"
|
||||||
|
|
||||||
|
# Controls when the action will run.
|
||||||
|
on:
|
||||||
|
# Triggers the workflow on push or pull request events but only for the master branch
|
||||||
|
workflow_dispatch: ~
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: docker build and publish
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
|
||||||
|
# https://github.com/docker/setup-qemu-action
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
# https://github.com/docker/setup-buildx-action
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
PGM_VERSION=$(python .github/get_version.py)
|
||||||
|
docker buildx build \
|
||||||
|
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
||||||
|
--output "type=image,push=true" \
|
||||||
|
--platform "linux/amd64,linux/arm64/v8" \
|
||||||
|
--build-arg "S6_ARCH=amd64" \
|
||||||
|
--tag "${{ secrets.DOCKER_REPO }}:latest" \
|
||||||
|
--tag "${{ secrets.DOCKER_REPO }}:${PGM_VERSION}" \
|
||||||
|
-f Dockerfile \
|
||||||
|
.
|
41
.gitea/workflows/docker_dev.yml
Normal file
41
.gitea/workflows/docker_dev.yml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
name: "Docker Dev Build"
|
||||||
|
|
||||||
|
# Controls when the action will run.
|
||||||
|
on:
|
||||||
|
# Triggers the workflow on push or pull request events but only for the master branch
|
||||||
|
workflow_dispatch: ~
|
||||||
|
push:
|
||||||
|
branches: [ development ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: docker build and publish
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
|
||||||
|
# https://github.com/docker/setup-qemu-action
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
# https://github.com/docker/setup-buildx-action
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
PGM_VERSION=$(python .github/get_version.py)
|
||||||
|
docker buildx build \
|
||||||
|
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
||||||
|
--output "type=image,push=true" \
|
||||||
|
--platform "linux/amd64,linux/arm64/v8" \
|
||||||
|
--build-arg "S6_ARCH=amd64" \
|
||||||
|
--tag "${{ secrets.DOCKER_REPO }}:${PGM_VERSION}-dev" \
|
||||||
|
-f Dockerfile.alpine \
|
||||||
|
.
|
12
.github/get_version.py
vendored
Normal file
12
.github/get_version.py
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
with open("pagermaid/__init__.py", "r", encoding="utf-8") as f:
|
||||||
|
if version_match := re.search(r'pgm_version = "(.*?)"', f.read()):
|
||||||
|
return version_match[1]
|
||||||
|
raise FileNotFoundError
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
print(get_version())
|
20
.github/workflows/docker.yml
vendored
20
.github/workflows/docker.yml
vendored
@ -18,24 +18,33 @@ jobs:
|
|||||||
DOCKERHUB_REPOSITORY: ${{ secrets.DOCKER_REPO }}
|
DOCKERHUB_REPOSITORY: ${{ secrets.DOCKER_REPO }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_TOKEN }}
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
|
||||||
- name: Setup Docker Buildx
|
# https://github.com/docker/setup-qemu-action
|
||||||
uses: crazy-max/ghaction-docker-buildx@v3
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
# https://github.com/docker/setup-buildx-action
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Buildx cache
|
- name: Buildx cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v4
|
||||||
id: buildx-cache
|
id: buildx-cache
|
||||||
with:
|
with:
|
||||||
path: /tmp/.buildx-cache
|
path: /tmp/.buildx-cache
|
||||||
key: ${{ runner.os }}-buildx
|
key: ${{ runner.os }}-buildx
|
||||||
|
|
||||||
|
- name: Get version
|
||||||
|
run: |
|
||||||
|
RAW_PGM_VERSION=$(python .github/get_version.py)
|
||||||
|
echo "PGM_VERSION=${RAW_PGM_VERSION}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
@ -45,5 +54,6 @@ jobs:
|
|||||||
--platform "linux/amd64,linux/arm64/v8" \
|
--platform "linux/amd64,linux/arm64/v8" \
|
||||||
--build-arg "S6_ARCH=amd64" \
|
--build-arg "S6_ARCH=amd64" \
|
||||||
--tag "${DOCKERHUB_REPOSITORY}:latest" \
|
--tag "${DOCKERHUB_REPOSITORY}:latest" \
|
||||||
|
--tag "${DOCKERHUB_REPOSITORY}:${PGM_VERSION} \
|
||||||
-f Dockerfile \
|
-f Dockerfile \
|
||||||
.
|
.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM ubuntu:latest
|
FROM ubuntu:jammy
|
||||||
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
||||||
LANG=zh_CN.UTF-8 \
|
LANG=zh_CN.UTF-8 \
|
||||||
SHELL=/bin/bash \
|
SHELL=/bin/bash \
|
||||||
@ -47,7 +47,6 @@ RUN source ~/.bashrc \
|
|||||||
libffi-dev \
|
libffi-dev \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
tcl8.6-dev \
|
tcl8.6-dev \
|
||||||
tk8.6-dev \
|
|
||||||
libimagequant-dev \
|
libimagequant-dev \
|
||||||
libraqm-dev \
|
libraqm-dev \
|
||||||
libjpeg-dev \
|
libjpeg-dev \
|
||||||
@ -56,7 +55,6 @@ RUN source ~/.bashrc \
|
|||||||
libfreetype6-dev \
|
libfreetype6-dev \
|
||||||
liblcms2-dev \
|
liblcms2-dev \
|
||||||
libwebp-dev \
|
libwebp-dev \
|
||||||
python3-tk \
|
|
||||||
libharfbuzz-dev \
|
libharfbuzz-dev \
|
||||||
libfribidi-dev \
|
libfribidi-dev \
|
||||||
libxcb1-dev \
|
libxcb1-dev \
|
||||||
@ -89,7 +87,6 @@ RUN source ~/.bashrc \
|
|||||||
libffi-dev \
|
libffi-dev \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
tcl8.6-dev \
|
tcl8.6-dev \
|
||||||
tk8.6-dev \
|
|
||||||
libimagequant-dev \
|
libimagequant-dev \
|
||||||
libraqm-dev \
|
libraqm-dev \
|
||||||
libjpeg-dev \
|
libjpeg-dev \
|
||||||
@ -98,7 +95,6 @@ RUN source ~/.bashrc \
|
|||||||
libfreetype6-dev \
|
libfreetype6-dev \
|
||||||
liblcms2-dev \
|
liblcms2-dev \
|
||||||
libwebp-dev \
|
libwebp-dev \
|
||||||
python3-tk \
|
|
||||||
libharfbuzz-dev \
|
libharfbuzz-dev \
|
||||||
libfribidi-dev \
|
libfribidi-dev \
|
||||||
libxcb1-dev \
|
libxcb1-dev \
|
||||||
|
Loading…
Reference in New Issue
Block a user