chore: build

pull/249/head
zijiren233 2 years ago
parent 7421c8812a
commit 250a8ec250

@ -13,36 +13,28 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
get_all_targets:
get-targets:
name: Get all targets
runs-on: ubuntu-latest
outputs:
TARGETS: ${{ steps.get_all_targets.outputs.TARGETS }}
targets: ${{ steps.get-targets.outputs.targets }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get all targets
id: get_all_targets
run: |
declare -a arr=()
OIFS="$IFS"
IFS=$'\n,'
for line in $(BUILD_CONFIG=script/build.config.sh bash script/build.sh --show-all-platforms); do
arr+=("$line")
done
IFS="$OIFS"
printf -v json '"%s",' "${arr[@]}"
json="[${json%,}]"
echo "TARGETS=$json" >> $GITHUB_OUTPUT
- name: Get targets
id: get-targets
uses: zijiren233/go-build-action@v1
with:
show-all-targets: true
build:
build-targets:
name: Build
runs-on: ubuntu-latest
needs: get_all_targets
needs: get-targets
strategy:
matrix:
target: ${{ fromJson(needs.get_all_targets.outputs.TARGETS) }}
target: ${{ fromJson(needs.get-targets.outputs.targets) }}
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
@ -63,14 +55,12 @@ jobs:
with:
go-version: "1.23"
- name: Build
run: |
BUILD_CONFIG=script/build.config.sh bash \
script/build.sh \
--enable-micro \
--skip-init-web \
--platforms="${{ matrix.target }}" \
--more-go-cmd-args='-a -v'
- name: Build targets
uses: zijiren233/go-build-action@v1
with:
targets: ${{ matrix.target }}
enable-micro: true
config-args: --skip-init-web
- name: Get artifact name
id: get_artifact_name

@ -6,36 +6,28 @@ on:
- "v*"
jobs:
get_all_targets:
get-targets:
name: Get all targets
runs-on: ubuntu-latest
outputs:
TARGETS: ${{ steps.get_all_targets.outputs.TARGETS }}
targets: ${{ steps.get-targets.outputs.targets }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get all targets
id: get_all_targets
run: |
declare -a arr=()
OIFS="$IFS"
IFS=$'\n,'
for line in $(BUILD_CONFIG=script/build.config.sh bash script/build.sh --show-all-platforms); do
arr+=("$line")
done
IFS="$OIFS"
printf -v json '"%s",' "${arr[@]}"
json="[${json%,}]"
echo "TARGETS=$json" >> $GITHUB_OUTPUT
- name: Get targets
id: get-targets
uses: zijiren233/go-build-action@v1
with:
show-all-targets: true
release:
name: Release
needs: get_all_targets
needs: get-targets
runs-on: ubuntu-latest
strategy:
matrix:
target: ${{ fromJson(needs.get_all_targets.outputs.TARGETS) }}
target: ${{ fromJson(needs.get-targets.outputs.targets) }}
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
@ -60,14 +52,12 @@ jobs:
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_OUTPUT
- name: Build
run: |
BUILD_CONFIG=script/build.config.sh bash \
script/build.sh \
--enable-micro \
--version="v${{ steps.get_version.outputs.VERSION }}" \
--platforms="${{ matrix.target }}" \
--more-go-cmd-args='-a -v'
- name: Build targets
uses: zijiren233/go-build-action@v1
with:
targets: ${{ matrix.target }}
enable-micro: true
config-args: --version="v${{ steps.get_version.outputs.VERSION }}"
- name: Release
uses: softprops/action-gh-release@v2

@ -4,36 +4,28 @@ on:
workflow_dispatch:
jobs:
get_all_targets:
get-targets:
name: Get all targets
runs-on: ubuntu-latest
outputs:
TARGETS: ${{ steps.get_all_targets.outputs.TARGETS }}
targets: ${{ steps.get-targets.outputs.targets }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get all targets
id: get_all_targets
run: |
declare -a arr=()
OIFS="$IFS"
IFS=$'\n,'
for line in $(BUILD_CONFIG=script/build.config.sh bash script/build.sh --show-all-platforms); do
arr+=("$line")
done
IFS="$OIFS"
printf -v json '"%s",' "${arr[@]}"
json="[${json%,}]"
echo "TARGETS=$json" >> $GITHUB_OUTPUT
- name: Get targets
id: get-targets
uses: zijiren233/go-build-action@v1
with:
show-all-targets: true
release_dev:
name: Release dev
runs-on: ubuntu-latest
needs: get_all_targets
needs: get-targets
strategy:
matrix:
target: ${{ fromJson(needs.get_all_targets.outputs.TARGETS) }}
target: ${{ fromJson(needs.get-targets.outputs.targets) }}
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
@ -54,14 +46,11 @@ jobs:
with:
go-version: "1.23"
- name: Build
run: |
BUILD_CONFIG=script/build.config.sh bash \
script/build.sh \
--enable-micro \
--version=dev \
--platforms="${{ matrix.target }}" \
--more-go-cmd-args='-a -v'
- name: Build targets
uses: zijiren233/go-build-action@v1
with:
targets: ${{ matrix.target }}
enable-micro: true
- name: Release
uses: softprops/action-gh-release@v2

@ -6,19 +6,19 @@ ARG SKIP_INIT_WEB
ENV SKIP_INIT_WEB=${SKIP_INIT_WEB}
ENV BUILD_CONFIG=script/build.config.sh
WORKDIR /synctv
COPY ./ ./
RUN apk add --no-cache bash curl git g++
RUN bash script/build.sh --version=${VERSION} \
RUN curl -sL \
https://raw.githubusercontent.com/zijiren233/go-build-action/refs/tags/v1/build.sh | \
bash -s -- \
--version=${VERSION} \
--bin-name-no-suffix \
--force-gcc='gcc -static' \
--force-g++='g++ -static' \
--more-go-cmd-args='-a -v'
--force-gcc='gcc -static --static' \
--force-g++='g++ -static --static'
FROM alpine:latest

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save