BaiduNetdisk-Docker/.github/workflows/build.yml
2024-05-05 22:41:26 +08:00

85 lines
2.3 KiB
YAML

name: Build & Release
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
version:
description: "Version"
required: false
type: string
push:
branches:
- "main"
- "develop"
paths-ignore:
- "docs/**"
- "**.md"
env:
DOCKERHUB_SLUG: docker.io/yucatovo/baidunetdisk-docker
GHCR_SLUG: ghcr.io/yucat-ovo/baidunetdisk-docker
jobs:
prepare:
name: prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform: ["linux/amd64", "linux/arm64"]
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set variables
id: set-vars
run: |
echo "TARGET=$(echo ${{ matrix.platform }} | sed 's#/#-#g')" >> "$GITHUB_OUTPUT"
echo "ARCH=$(echo ${{ matrix.platform }} | sed 's#linux/##g')" >> "$GITHUB_OUTPUT"
- name: Docker Meta
uses: docker/metadata-action@v5
id: meta
with:
images: |
${{ env.DOCKERHUB_SLUG }}
${{ env.GHCR_SLUG }}
tags: |
type=ref,event=branch,prefix=br-,enable=${{ github.ref_name != github.event.repository.default_branch }}
type=edge,branch=develop,prefix=edge-
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=sha
labels: |
org.opencontainers.image.title=BaiduNetdisk-Docker
org.opencontainers.image.description=A BaiduNetdisk image base on Linuxserver.io's KasmVNC image.
org.opencontainers.image.vendor=YuCat-OVO
- name: Rename meta bake definition file
run: |
mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta.json"
- name: Print meta bake definition file
run: |
cat "/tmp/bake-meta.json"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ matrix.platform }}
- name: Upload meta bake definition
uses: actions/upload-artifact@v4
with:
name: bake-meta-${{ steps.set-vars.outputs.ARCH }}
path: /tmp/bake-meta.json
if-no-files-found: error
retention-days: 1