Skip to content
This repository was archived by the owner on Jul 21, 2024. It is now read-only.

Commit dd3e3fc

Browse files
committed
* Update github action: Build Docker Image
1 parent 84cab22 commit dd3e3fc

File tree

3 files changed

+196
-33
lines changed

3 files changed

+196
-33
lines changed

.github/workflows/docker.yml renamed to .github/workflows/build-docker.yml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This is a basic workflow to help you get started with Actions
22

3-
name: aliyundriver-Build
3+
name: Build Docker Image
44

55
# Controls when the action will run.
66
on:
@@ -29,35 +29,23 @@ env:
2929
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
3030
jobs:
3131
buildx:
32-
runs-on: ubuntu-22.04
32+
runs-on: ${{ matrix.target.os }}
33+
strategy:
34+
matrix:
35+
target:
36+
- { os: self-hosted, arch: arm64, suffix: linux }
37+
- { os: ubuntu-22.04, arch: amd64, suffix: linux }
3338
steps:
3439
-
3540
name: Checkout
3641
uses: actions/checkout@v3
37-
-
38-
name: Get current date
39-
id: date
40-
run: echo "::set-output name=today::$(date +'%Y%m%d')"
41-
-
42-
name: Set up QEMU
43-
uses: docker/setup-qemu-action@v1
44-
with:
45-
platforms: all
4642
-
47-
name: Set up Docker Buildx
48-
id: buildx
49-
uses: docker/setup-buildx-action@v1
43+
name: Fixup docker permission denied
44+
run: sudo chmod 777 /var/run/docker.sock
45+
if: matrix.target.os == 'self-hosted'
5046
-
5147
name: Available platforms
5248
run: echo ${{ steps.buildx.outputs.platforms }}
53-
-
54-
name: Cache Docker layers
55-
uses: actions/cache@v2
56-
with:
57-
path: /tmp/.buildx-cache
58-
key: ${{ runner.os }}-buildx-${{ github.sha }}
59-
restore-keys: |
60-
${{ runner.os }}-buildx-
6149
-
6250
name: Setup Gradle
6351
uses: gradle/gradle-build-action@v2
@@ -78,15 +66,27 @@ jobs:
7866
-
7967
run: echo "VERSION_INFORMATION=$(${{github.workspace}}/gradlew -q ciPrintVersionInformation)" >> $GITHUB_ENV
8068
-
81-
name: Build and push
82-
uses: docker/build-push-action@v2
69+
name: Build Docker Image
70+
run: docker build -t eritpchy/webdav-aliyundriver:${{ env.VERSION_INFORMATION }}-${{ matrix.target.arch }} .
71+
-
72+
name: Push Docker Image
73+
run: docker push eritpchy/webdav-aliyundriver:${{ env.VERSION_INFORMATION }}-${{ matrix.target.arch }}
74+
publish:
75+
needs: buildx
76+
runs-on: ubuntu-22.04
77+
steps:
78+
-
79+
name: Login to Docker Hub
80+
uses: docker/login-action@v2
8381
with:
84-
context: .
85-
file: ./Dockerfile
86-
platforms: linux/amd64,linux/arm64
87-
push: ${{ github.event_name != 'pull_request' }}
88-
cache-from: type=local,src=/tmp/.buildx-cache
89-
cache-to: type=local,dest=/tmp/.buildx-cache
90-
tags: |
91-
eritpchy/webdav-aliyundriver:latest
92-
eritpchy/webdav-aliyundriver:${{ env.VERSION_INFORMATION }}-${{ steps.date.outputs.today }}
82+
username: ${{ secrets.DOCKERHUB_USERNAME }}
83+
password: ${{ secrets.DOCKERHUB_TOKEN }}
84+
-
85+
name: Create Docker Manifest
86+
run: |
87+
docker manifest create eritpchy/webdav-aliyundriver:latest \
88+
--amend eritpchy/webdav-aliyundriver:2.4.0-amd64 \
89+
--amend eritpchy/webdav-aliyundriver:2.4.0-arm64
90+
-
91+
name: Push Docker Manifest
92+
run: docker manifest push eritpchy/webdav-aliyundriver:latest

.github/workflows/build-linux.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Build Linux
4+
5+
# Controls when the action will run.
6+
on:
7+
push:
8+
branches:
9+
- '*'
10+
pull_request:
11+
branches:
12+
- '*'
13+
# schedule:
14+
# - cron: "0 0 * * */3"
15+
16+
# Allows you to run this workflow manually from the Actions tab
17+
workflow_dispatch:
18+
inputs:
19+
logLevel:
20+
description: 'Log level'
21+
required: true
22+
default: 'warning'
23+
tags:
24+
description: 'Test scenario tags'
25+
26+
env:
27+
TZ: Asia/Shanghai
28+
29+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
30+
jobs:
31+
buildx:
32+
runs-on: ${{ matrix.target.os }}
33+
strategy:
34+
matrix:
35+
target:
36+
- { os: macos-12, arch: x86_64, suffix: darwin }
37+
- { os: self-hosted, arch: arm64, suffix: linux }
38+
- { os: ubuntu-22.04, arch: amd64, suffix: linux }
39+
steps:
40+
-
41+
name: Checkout
42+
uses: actions/checkout@v3
43+
-
44+
name: Get current date
45+
id: date
46+
run: echo "::set-output name=today::$(date +'%Y%m%d')"
47+
-
48+
name: Installing Graalvm dependencies
49+
run: sudo apt install -y make gcc libz-dev
50+
if: matrix.target.suffix == 'linux'
51+
-
52+
name: Setup Graalvm
53+
uses: graalvm/setup-graalvm@v1
54+
with:
55+
version: 'latest'
56+
java-version: '17'
57+
components: 'native-image'
58+
github-token: ${{ secrets.GITHUB_TOKEN }}
59+
cache: 'gradle'
60+
- run: chmod +x ./gradlew
61+
# Set VERSION_INFORMATION
62+
- run: echo "VERSION_INFORMATION=$(${{github.workspace}}/gradlew --no-daemon -q ciPrintVersionInformation)" >> $GITHUB_ENV
63+
-
64+
name: Build project
65+
run: ./gradlew --no-daemon nativeCompile
66+
-
67+
run: mv build/native/nativeCompile/webdav-aliyundriver-android build/native/nativeCompile/webdav-aliyundriver-${{matrix.target.suffix}}-${{matrix.target.arch}}
68+
-
69+
name: Archive artifacts
70+
uses: thedoctor0/zip-release@0.7.1
71+
with:
72+
type: 'tar'
73+
filename: 'webdav-aliyundriver-${{matrix.target.suffix}}-${{matrix.target.arch}}.tar.gz'
74+
directory: 'build/native/nativeCompile/'
75+
path: "./webdav-aliyundriver-${{matrix.target.suffix}}-${{matrix.target.arch}}"
76+
-
77+
name: Upload artifacts
78+
uses: bxb100/action-upload-webdav@v1
79+
with:
80+
webdav_address: ${{secrets.WEBDAV_ADDRESS}}
81+
webdav_username: ${{secrets.WEBDAV_USERNAME}}
82+
webdav_password: ${{secrets.WEBDAV_PASSWORD}}
83+
webdav_upload_path: "/${{ env.VERSION_INFORMATION }}"
84+
files: |
85+
build/native/nativeCompile/webdav-aliyundriver-${{matrix.target.suffix}}-${{matrix.target.arch}}.tar.gz

.github/workflows/build-windows.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Build Windows
4+
5+
# Controls when the action will run.
6+
on:
7+
push:
8+
branches:
9+
- '*'
10+
pull_request:
11+
branches:
12+
- '*'
13+
# schedule:
14+
# - cron: "0 0 * * */3"
15+
16+
# Allows you to run this workflow manually from the Actions tab
17+
workflow_dispatch:
18+
inputs:
19+
logLevel:
20+
description: 'Log level'
21+
required: true
22+
default: 'warning'
23+
tags:
24+
description: 'Test scenario tags'
25+
26+
env:
27+
TZ: Asia/Shanghai
28+
29+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
30+
jobs:
31+
buildx:
32+
runs-on: ${{ matrix.target.os }}
33+
strategy:
34+
matrix:
35+
target:
36+
- { os: windows-2022, arch: amd64, suffix: windows }
37+
steps:
38+
-
39+
name: Checkout
40+
uses: actions/checkout@v3
41+
-
42+
name: Get current date
43+
id: date
44+
run: echo "::set-output name=today::$(date +'%Y%m%d')"
45+
-
46+
name: Setup Graalvm
47+
uses: graalvm/setup-graalvm@v1
48+
with:
49+
version: 'latest'
50+
java-version: '17'
51+
components: 'native-image'
52+
github-token: ${{ secrets.GITHUB_TOKEN }}
53+
cache: 'gradle'
54+
# Set VERSION_INFORMATION
55+
- run: echo "VERSION_INFORMATION=$(./gradlew --no-daemon -q ciPrintVersionInformation)" >> $env:GITHUB_ENV
56+
-
57+
name: Build project
58+
run: ./gradlew --no-daemon nativeCompile
59+
-
60+
run: mv build/native/nativeCompile/webdav-aliyundriver-android.exe build/native/nativeCompile/webdav-aliyundriver-${{matrix.target.suffix}}-${{matrix.target.arch}}.exe
61+
-
62+
name: Archive artifacts
63+
uses: thedoctor0/zip-release@0.7.1
64+
with:
65+
type: 'zip'
66+
filename: 'webdav-aliyundriver-${{matrix.target.suffix}}-${{matrix.target.arch}}.exe.zip'
67+
directory: 'build/native/nativeCompile/'
68+
path: "./webdav-aliyundriver-${{matrix.target.suffix}}-${{matrix.target.arch}}.exe"
69+
-
70+
name: Upload artifacts
71+
uses: bxb100/action-upload-webdav@v1
72+
with:
73+
webdav_address: ${{secrets.WEBDAV_ADDRESS}}
74+
webdav_username: ${{secrets.WEBDAV_USERNAME}}
75+
webdav_password: ${{secrets.WEBDAV_PASSWORD}}
76+
webdav_upload_path: "/${{ env.VERSION_INFORMATION }}"
77+
files: |
78+
build/native/nativeCompile/webdav-aliyundriver-${{matrix.target.suffix}}-${{matrix.target.arch}}.exe.zip

0 commit comments

Comments
 (0)