chore: better workflow

This commit is contained in:
gVisor bot 2023-03-01 13:41:25 +08:00
parent b9ee4027e5
commit f6c7ba4086
4 changed files with 49 additions and 34 deletions

View file

@ -37,35 +37,40 @@ jobs:
id: "2", id: "2",
} }
- { - {
type: "WithoutCGO", type: "WithoutCGO",
target: "linux-arm64 linux-mips64 linux-mips64le", target: "linux-arm64 linux-mips64 linux-mips64le",
id: "3", id: "3",
} }
- { - {
type: "WithoutCGO", type: "WithoutCGO",
target: "linux-mips-softfloat linux-mips-hardfloat linux-mipsle-softfloat linux-mipsle-hardfloat", target: "linux-mips-softfloat linux-mips-hardfloat linux-mipsle-softfloat linux-mipsle-hardfloat",
id: "4", id: "4",
} }
- { - {
type: "WithoutCGO", type: "WithoutCGO",
target: "freebsd-386 freebsd-amd64 freebsd-arm64", target: "linux-386 linux-riscv64",
id: "5", id: "5",
} }
- { - {
type: "WithoutCGO", type: "WithoutCGO",
target: "windows-amd64-compatible windows-amd64 windows-386", target: "freebsd-386 freebsd-amd64 freebsd-arm64",
id: "6", id: "6",
} }
- { - {
type: "WithoutCGO", type: "WithoutCGO",
target: "windows-arm64 windows-arm32v7", target: "windows-amd64-compatible windows-amd64 windows-386",
id: "7", id: "7",
} }
- { - {
type: "WithoutCGO", type: "WithoutCGO",
target: "darwin-amd64 darwin-arm64 android-arm64", target: "windows-arm64 windows-arm32v7",
id: "8", id: "8",
} }
- {
type: "WithoutCGO",
target: "darwin-amd64 darwin-arm64 android-arm64",
id: "9",
}
- { type: "WithCGO", target: "windows/*", id: "1" } - { type: "WithCGO", target: "windows/*", id: "1" }
- { type: "WithCGO", target: "linux/386", id: "2" } - { type: "WithCGO", target: "linux/386", id: "2" }
- { type: "WithCGO", target: "linux/amd64", id: "3" } - { type: "WithCGO", target: "linux/amd64", id: "3" }
@ -193,6 +198,10 @@ jobs:
ls -la ls -la
cd .. cd ..
- name: Save version
run: echo ${VERSION} > bin/version.txt
shell: bash
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
if: ${{ success() }} if: ${{ success() }}
with: with:
@ -329,5 +338,7 @@ jobs:
linux/386 linux/386
linux/amd64 linux/amd64
linux/arm64/v8 linux/arm64/v8
linux/arm/v7
# linux/riscv64
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}

View file

@ -1,4 +1,6 @@
FROM alpine:latest as builder FROM alpine:latest as builder
ARG TARGETPLATFORM
RUN echo "I'm building for $TARGETPLATFORM"
RUN apk add --no-cache gzip && \ RUN apk add --no-cache gzip && \
mkdir /clash-config && \ mkdir /clash-config && \
@ -10,7 +12,7 @@ COPY docker/file-name.sh /clash/file-name.sh
WORKDIR /clash WORKDIR /clash
COPY bin/ bin/ COPY bin/ bin/
RUN FILE_NAME=`sh file-name.sh` && echo $FILE_NAME && \ RUN FILE_NAME=`sh file-name.sh` && echo $FILE_NAME && \
FILE_NAME=`ls bin/ | egrep "$FILE_NAME.*"|awk NR==1` && \ FILE_NAME=`ls bin/ | egrep "$FILE_NAME.*"|awk NR==1` && echo $FILE_NAME && \
mv bin/$FILE_NAME clash.gz && gzip -d clash.gz && echo "$FILE_NAME" > /clash-config/test mv bin/$FILE_NAME clash.gz && gzip -d clash.gz && echo "$FILE_NAME" > /clash-config/test
FROM alpine:latest FROM alpine:latest
LABEL org.opencontainers.image.source="https://github.com/MetaCubeX/Clash.Meta" LABEL org.opencontainers.image.source="https://github.com/MetaCubeX/Clash.Meta"

View file

@ -101,6 +101,9 @@ linux-mips64:
linux-mips64le: linux-mips64le:
GOARCH=mips64le GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ GOARCH=mips64le GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
linux-riscv64:
GOARCH=riscv64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
android-arm64: android-arm64:
GOARCH=arm64 GOOS=android $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ GOARCH=arm64 GOOS=android $(GOBUILD) -o $(BINDIR)/$(NAME)-$@

View file

@ -1,26 +1,25 @@
#!/bin/sh #!/bin/sh
os="clash.meta-linux-" os="clash.meta-linux-"
arch=`uname -m` case $TARGETPLATFORM in
case $arch in "linux/amd64")
"x86_64")
arch="amd64-compatible" arch="amd64-compatible"
;; ;;
"x86") "linux/386")
arch="386-cgo" arch="386"
;; ;;
"aarch64") "linux/arm64")
arch="arm64" arch="arm64"
;; ;;
"armv7l") "linux/arm/v7")
arch="armv7" arch="armv7"
;; ;;
"riscv64") "riscv64")
arch="riscv64-cgo" arch="riscv64"
;; ;;
*) *)
echo "Unknown architecture" echo "Unknown architecture"
exit 1 exit 1
;; ;;
esac esac
file_name="$os$arch" file_name="$os$arch-$(cat bin/version.txt)"
echo $file_name echo $file_name