| name: Beta Release (Docker) |
|
|
| on: |
| workflow_dispatch: |
| push: |
| branches: |
| - main |
| pull_request: |
| branches: |
| - main |
|
|
| concurrency: |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| cancel-in-progress: true |
|
|
| env: |
| DOCKERHUB_ORG_NAME: ${{ vars.DOCKERHUB_ORG_NAME || 'openlistteam' }} |
| GHCR_ORG_NAME: ${{ vars.GHCR_ORG_NAME || 'openlistteam' }} |
| IMAGE_NAME: openlist-git |
| IMAGE_NAME_DOCKERHUB: openlist |
| REGISTRY: ghcr.io |
| ARTIFACT_NAME: 'binaries_docker_release' |
| RELEASE_PLATFORMS: 'linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/ppc64le,linux/riscv64,linux/loong64' |
| IMAGE_PUSH: ${{ github.event_name == 'push' }} |
| IMAGE_TAGS_BETA: | |
| type=ref,event=pr |
| type=raw,value=beta,enable={{is_default_branch}} |
| |
| jobs: |
| build_binary: |
| name: Build Binaries for Docker Release (Beta) |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v6 |
|
|
| - uses: actions/setup-go@v5 |
| with: |
| go-version: '1.25.0' |
|
|
| - name: Cache Musl |
| id: cache-musl |
| uses: actions/cache@v4 |
| with: |
| path: build/musl-libs |
| key: docker-musl-libs-v2 |
|
|
| - name: Download Musl Library |
| if: steps.cache-musl.outputs.cache-hit != 'true' |
| run: bash build.sh prepare docker-multiplatform |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
|
| - name: Build go binary (beta) |
| run: bash build.sh beta docker-multiplatform |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| FRONTEND_REPO: ${{ vars.FRONTEND_REPO }} |
|
|
| - name: Upload artifacts |
| uses: actions/upload-artifact@v4 |
| with: |
| name: ${{ env.ARTIFACT_NAME }} |
| overwrite: true |
| path: | |
| build/ |
| !build/*.tgz |
| !build/musl-libs/** |
| |
| release_docker: |
| needs: build_binary |
| name: Release Docker image (Beta) |
| runs-on: ubuntu-latest |
| permissions: |
| packages: write |
| strategy: |
| matrix: |
| image: ["latest", "ffmpeg", "aria2", "aio"] |
| include: |
| - image: "latest" |
| base_image_tag: "base" |
| build_arg: "" |
| tag_favor: "" |
| - image: "ffmpeg" |
| base_image_tag: "ffmpeg" |
| build_arg: INSTALL_FFMPEG=true |
| tag_favor: "suffix=-ffmpeg,onlatest=true" |
| - image: "aria2" |
| base_image_tag: "aria2" |
| build_arg: INSTALL_ARIA2=true |
| tag_favor: "suffix=-aria2,onlatest=true" |
| - image: "aio" |
| base_image_tag: "aio" |
| build_arg: | |
| INSTALL_FFMPEG=true |
| INSTALL_ARIA2=true |
| tag_favor: "suffix=-aio,onlatest=true" |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v6 |
| - uses: actions/download-artifact@v4 |
| with: |
| name: ${{ env.ARTIFACT_NAME }} |
| path: 'build/' |
|
|
| - name: Set up QEMU |
| uses: docker/setup-qemu-action@v3 |
|
|
| - name: Set up Docker Buildx |
| uses: docker/setup-buildx-action@v3 |
|
|
| - name: Login to GitHub Container Registry |
| if: env.IMAGE_PUSH == 'true' |
| uses: docker/login-action@v3 |
| with: |
| registry: ${{ env.REGISTRY }} |
| username: ${{ github.actor }} |
| password: ${{ secrets.GITHUB_TOKEN }} |
|
|
| - name: Login to DockerHub Container Registry |
| if: env.IMAGE_PUSH == 'true' |
| uses: docker/login-action@v3 |
| with: |
| username: ${{ vars.DOCKERHUB_ORG_NAME_BACKUP || env.DOCKERHUB_ORG_NAME }} |
| password: ${{ secrets.DOCKERHUB_TOKEN }} |
|
|
| - name: Docker meta |
| id: meta |
| uses: docker/metadata-action@v5 |
| with: |
| images: | |
| ${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ env.IMAGE_NAME }} |
| ${{ env.DOCKERHUB_ORG_NAME }}/${{ env.IMAGE_NAME_DOCKERHUB }} |
| tags: ${{ env.IMAGE_TAGS_BETA }} |
| flavor: | |
| ${{ matrix.tag_favor }} |
| |
| - name: Build and push |
| id: docker_build |
| uses: docker/build-push-action@v6 |
| with: |
| context: . |
| file: Dockerfile.ci |
| push: ${{ env.IMAGE_PUSH == 'true' }} |
| build-args: | |
| BASE_IMAGE_TAG=${{ matrix.base_image_tag }} |
| ${{ matrix.build_arg }} |
| tags: ${{ steps.meta.outputs.tags }} |
| labels: ${{ steps.meta.outputs.labels }} |
| platforms: ${{ env.RELEASE_PLATFORMS }} |
|
|