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

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

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

@ -6,19 +6,19 @@ ARG SKIP_INIT_WEB
ENV SKIP_INIT_WEB=${SKIP_INIT_WEB} ENV SKIP_INIT_WEB=${SKIP_INIT_WEB}
ENV BUILD_CONFIG=script/build.config.sh
WORKDIR /synctv WORKDIR /synctv
COPY ./ ./ COPY ./ ./
RUN apk add --no-cache bash curl git g++ 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 \ --bin-name-no-suffix \
--force-gcc='gcc -static' \ --force-gcc='gcc -static --static' \
--force-g++='g++ -static' \ --force-g++='g++ -static --static'
--more-go-cmd-args='-a -v'
FROM alpine:latest FROM alpine:latest

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