mirror of
https://github.com/YuCat-OVO/BaiduNetdisk-Docker
synced 2025-05-10 20:10:04 +08:00
Build
This commit is contained in:
parent
a74791b18c
commit
c5be9119bc
95
.github/workflows/build.yml
vendored
95
.github/workflows/build.yml
vendored
@ -27,21 +27,10 @@ jobs:
|
|||||||
prepare:
|
prepare:
|
||||||
name: prepare
|
name: prepare
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
platform: ["linux/amd64", "linux/arm64"]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@master
|
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
|
- name: Docker Meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
id: meta
|
id: meta
|
||||||
@ -50,8 +39,8 @@ jobs:
|
|||||||
${{ env.DOCKERHUB_SLUG }}
|
${{ env.DOCKERHUB_SLUG }}
|
||||||
${{ env.GHCR_SLUG }}
|
${{ env.GHCR_SLUG }}
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch,prefix=br-,enable=${{ github.ref_name != github.event.repository.default_branch }}
|
type=ref,event=branch,enable=${{ github.ref_name != github.event.repository.default_branch }}
|
||||||
type=edge,branch=develop,prefix=edge-
|
type=edge,branch=develop
|
||||||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
||||||
type=sha
|
type=sha
|
||||||
labels: |
|
labels: |
|
||||||
@ -63,9 +52,43 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta.json"
|
mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta.json"
|
||||||
|
|
||||||
- name: Print meta bake definition file
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Upload meta bake definition
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: bake-meta
|
||||||
|
path: /tmp/bake-meta.json
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- prepare
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform: ["linux/amd64", "linux/arm64"]
|
||||||
|
steps:
|
||||||
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
cat "/tmp/bake-meta.json"
|
platform=${{ matrix.platform }}
|
||||||
|
echo "PLATFORM_PAIR=${platform//\//-}" >> "$GITHUB_ENV"
|
||||||
|
echo "ARCH=${platform//linux\//}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Download meta bake definition
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: bake-meta
|
||||||
|
path: /tmp
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
@ -73,12 +96,46 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
platforms: ${{ matrix.platform }}
|
buildkitd-flags: "--debug"
|
||||||
|
|
||||||
- name: Upload meta bake definition
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to GHCR
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
id: bake
|
||||||
|
uses: docker/bake-action@v4
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./docker-bake.hcl
|
||||||
|
/tmp/bake-meta.json
|
||||||
|
targets: ${{ env.PLATFORM_PAIR }}
|
||||||
|
set: |
|
||||||
|
*.tags=
|
||||||
|
*.platform=${{ matrix.platform }}
|
||||||
|
*.cache-from=type=gha,scope=build-${{ env.PLATFORM_PAIR }}
|
||||||
|
*.cache-to=type=gha,scope=build-${{ env.PLATFORM_PAIR }}
|
||||||
|
*.output=type=image,"name=${{ env.DOCKERHUB_SLUG }},${{ env.GHCR_SLUG }}",push-by-digest=true,name-canonical=true,push=true
|
||||||
|
|
||||||
|
- name: Export digest
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/digests
|
||||||
|
digest="${{ fromJSON(steps.bake.outputs.metadata).image['containerimage.digest'] }}"
|
||||||
|
touch "/tmp/digests/${digest#sha256:}"
|
||||||
|
|
||||||
|
- name: Upload digest
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: bake-meta-${{ steps.set-vars.outputs.ARCH }}
|
name: digests-${{ env.PLATFORM_PAIR }}
|
||||||
path: /tmp/bake-meta.json
|
path: /tmp/digests/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|||||||
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
@ -32,8 +32,9 @@ jobs:
|
|||||||
- name: Set the value
|
- name: Set the value
|
||||||
id: set-vars
|
id: set-vars
|
||||||
run: |
|
run: |
|
||||||
echo "TARGET=$(echo ${{ matrix.platform }} | sed 's#/#-#g')" >> "$GITHUB_OUTPUT"
|
platform=${{ matrix.platform }}
|
||||||
echo "ARCH=$(echo ${{ matrix.platform }} | sed 's#linux/##g')" >> "$GITHUB_OUTPUT"
|
echo "PLATFORM_PAIR=${platform//\//-}" >> "$GITHUB_ENV"
|
||||||
|
echo "ARCH=${platform//linux\//}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
@ -48,9 +49,9 @@ jobs:
|
|||||||
uses: docker/bake-action@v4
|
uses: docker/bake-action@v4
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
targets: ${{ steps.set-vars.outputs.TARGET }}
|
targets: ${{ env.TARGET }}
|
||||||
env:
|
env:
|
||||||
DEFAULT_TAG: ${{ env.BUILD_TAG }}-${{ steps.set-vars.outputs.TARGET }}
|
DEFAULT_TAG: ${{ env.BUILD_TAG }}-${{ env.PLATFORM_PAIR }}
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user