mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 09:14:27 +08:00
provide officially built macOS packages
This commit is contained in:
@@ -0,0 +1,55 @@
|
|||||||
|
name: Build backend file for macOS
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
go-version:
|
||||||
|
required: false
|
||||||
|
description: "The Go version to use for building the macOS backend. The version should be in the format of 'x.y.z'."
|
||||||
|
default: "1.26.2"
|
||||||
|
release-build:
|
||||||
|
required: false
|
||||||
|
description: "Whether to build the macOS backend in release mode. If set to '1', the backend will be built in release mode. Otherwise, it will be built in development mode."
|
||||||
|
build-unix-time:
|
||||||
|
required: false
|
||||||
|
description: "The unix time to use for building the macOS backend. The value should be a string representing the unix time in seconds."
|
||||||
|
build-date:
|
||||||
|
required: false
|
||||||
|
description: "The date to use for building the macOS backend. The value should be a string representing the date in the format of 'YYYYMMDD'."
|
||||||
|
check-3rd-api:
|
||||||
|
required: false
|
||||||
|
description: "Whether to run integration tests that call third party APIs. If set to '1', the tests will be run. Otherwise, the tests will be skipped."
|
||||||
|
skip-tests:
|
||||||
|
required: false
|
||||||
|
description: "Whether to skip tests when building the macOS backend. If set to '1', the tests will be skipped. Otherwise, the tests will be run."
|
||||||
|
architecture:
|
||||||
|
required: true
|
||||||
|
description: "The name of the architecture to build the macOS package for."
|
||||||
|
backend-artifact-name-prefix:
|
||||||
|
required: true
|
||||||
|
description: "The prefix for the macOS backend artifact name."
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version: ${{ inputs.go-version }}
|
||||||
|
|
||||||
|
- name: Build backend for macOS-${{ inputs.architecture }}
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
RELEASE_BUILD: "${{ inputs.release-build }}"
|
||||||
|
BUILD_PIPELINE: "1"
|
||||||
|
BUILD_UNIXTIME: "${{ inputs.build-unix-time }}"
|
||||||
|
BUILD_DATE: "${{ inputs.build-date }}"
|
||||||
|
CHECK_3RD_API: "${{ inputs.check-3rd-api }}"
|
||||||
|
SKIP_TESTS: "${{ inputs.skip-tests }}"
|
||||||
|
run: |
|
||||||
|
./build.sh backend
|
||||||
|
|
||||||
|
- name: Upload macOS-${{ inputs.architecture }} backend artifact
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.backend-artifact-name-prefix }}-macos-${{ inputs.architecture }}
|
||||||
|
path: ezbookkeeping
|
||||||
|
if-no-files-found: error
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
name: Build packages for macOS
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
architecture:
|
||||||
|
required: true
|
||||||
|
description: "The name of the architecture to build the macOS package for."
|
||||||
|
package-file-name-prefix:
|
||||||
|
required: true
|
||||||
|
description: "The prefix for the macOS package file name."
|
||||||
|
backend-artifact-name-prefix:
|
||||||
|
required: true
|
||||||
|
description: "The prefix for the macOS backend artifact name."
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Download macOS-${{ inputs.architecture }} backend file
|
||||||
|
uses: actions/download-artifact@v8
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.backend-artifact-name-prefix }}-macos-${{ inputs.architecture }}
|
||||||
|
path: ${{ runner.temp }}/backend
|
||||||
|
|
||||||
|
- name: Download linux-amd64 packaged files
|
||||||
|
uses: actions/download-artifact@v8
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.package-file-name-prefix }}-linux-amd64.tar.gz
|
||||||
|
path: ${{ runner.temp }}/package
|
||||||
|
|
||||||
|
- name: Extract frontend files from linux-amd64 package
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p package
|
||||||
|
tar -xzf ${{ runner.temp }}/package/${{ inputs.package-file-name-prefix }}-linux-amd64.tar.gz -C package
|
||||||
|
|
||||||
|
- name: Package macOS-${{ inputs.architecture }} package
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p ezbookkeeping
|
||||||
|
mkdir -p ezbookkeeping/data
|
||||||
|
mkdir -p ezbookkeeping/storage
|
||||||
|
mkdir -p ezbookkeeping/log
|
||||||
|
cp ${{ runner.temp }}/backend/ezbookkeeping ezbookkeeping/
|
||||||
|
cp -R package/public ezbookkeeping/public
|
||||||
|
cp -R conf ezbookkeeping/conf
|
||||||
|
cp -R templates ezbookkeeping/templates
|
||||||
|
cp LICENSE ezbookkeeping/
|
||||||
|
cd ezbookkeeping
|
||||||
|
chmod +x ezbookkeeping
|
||||||
|
tar -czf ${{ runner.temp }}/${{ inputs.package-file-name-prefix }}-macos-${{ inputs.architecture }}.tar.gz *
|
||||||
|
cd ..
|
||||||
|
rm -rf ezbookkeeping
|
||||||
|
|
||||||
|
- name: Upload macOS-${{ inputs.architecture }} artifact
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
archive: false
|
||||||
|
path: ${{ runner.temp }}/${{ inputs.package-file-name-prefix }}-macos-${{ inputs.architecture }}.tar.gz
|
||||||
|
if-no-files-found: error
|
||||||
@@ -128,6 +128,23 @@ jobs:
|
|||||||
skip-tests: ${{ vars.SKIP_TESTS }}
|
skip-tests: ${{ vars.SKIP_TESTS }}
|
||||||
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
||||||
|
|
||||||
|
build-macos-backend:
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- uses: ./.github/actions/build-macos-backend
|
||||||
|
with:
|
||||||
|
architecture: arm64
|
||||||
|
build-unix-time: ${{ needs.setup.outputs.build-unix-time }}
|
||||||
|
build-date: ${{ needs.setup.outputs.build-date }}
|
||||||
|
check-3rd-api: ${{ vars.CHECK_3RD_API }}
|
||||||
|
skip-tests: ${{ vars.SKIP_TESTS }}
|
||||||
|
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
||||||
|
|
||||||
build-windows-package:
|
build-windows-package:
|
||||||
needs:
|
needs:
|
||||||
- setup
|
- setup
|
||||||
@@ -142,3 +159,19 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
package-file-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-package-file-name-prefix }}
|
package-file-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-package-file-name-prefix }}
|
||||||
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
||||||
|
|
||||||
|
build-macos-package:
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
- build-macos-backend
|
||||||
|
- build-linux-docker-and-package-x86
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- uses: ./.github/actions/build-macos-package
|
||||||
|
with:
|
||||||
|
architecture: arm64
|
||||||
|
package-file-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-package-file-name-prefix }}
|
||||||
|
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
||||||
|
|||||||
@@ -162,6 +162,24 @@ jobs:
|
|||||||
skip-tests: ${{ vars.SKIP_TESTS }}
|
skip-tests: ${{ vars.SKIP_TESTS }}
|
||||||
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
||||||
|
|
||||||
|
build-macos-backend:
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- uses: ./.github/actions/build-macos-backend
|
||||||
|
with:
|
||||||
|
architecture: arm64
|
||||||
|
release-build: 1
|
||||||
|
build-unix-time: ${{ needs.setup.outputs.build-unix-time }}
|
||||||
|
build-date: ${{ needs.setup.outputs.build-date }}
|
||||||
|
check-3rd-api: ${{ vars.CHECK_3RD_API }}
|
||||||
|
skip-tests: ${{ vars.SKIP_TESTS }}
|
||||||
|
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
||||||
|
|
||||||
build-windows-package:
|
build-windows-package:
|
||||||
needs:
|
needs:
|
||||||
- setup
|
- setup
|
||||||
@@ -177,6 +195,22 @@ jobs:
|
|||||||
package-file-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-package-file-name-prefix }}
|
package-file-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-package-file-name-prefix }}
|
||||||
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
||||||
|
|
||||||
|
build-macos-package:
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
- build-macos-backend
|
||||||
|
- build-linux-docker-and-package-x86
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- uses: ./.github/actions/build-macos-package
|
||||||
|
with:
|
||||||
|
architecture: arm64
|
||||||
|
package-file-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-package-file-name-prefix }}
|
||||||
|
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
||||||
|
|
||||||
publish-release:
|
publish-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
@@ -184,6 +218,7 @@ jobs:
|
|||||||
- build-linux-docker-and-package-x86
|
- build-linux-docker-and-package-x86
|
||||||
- build-linux-docker-and-package-arm
|
- build-linux-docker-and-package-arm
|
||||||
- build-windows-package
|
- build-windows-package
|
||||||
|
- build-macos-package
|
||||||
- push-linux-docker
|
- push-linux-docker
|
||||||
steps:
|
steps:
|
||||||
- name: Download all packaged files
|
- name: Download all packaged files
|
||||||
|
|||||||
@@ -159,6 +159,23 @@ jobs:
|
|||||||
skip-tests: ${{ vars.SKIP_TESTS }}
|
skip-tests: ${{ vars.SKIP_TESTS }}
|
||||||
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
||||||
|
|
||||||
|
build-macos-backend:
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- uses: ./.github/actions/build-macos-backend
|
||||||
|
with:
|
||||||
|
architecture: arm64
|
||||||
|
build-unix-time: ${{ needs.setup.outputs.build-unix-time }}
|
||||||
|
build-date: ${{ needs.setup.outputs.build-date }}
|
||||||
|
check-3rd-api: ${{ vars.CHECK_3RD_API }}
|
||||||
|
skip-tests: ${{ vars.SKIP_TESTS }}
|
||||||
|
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
||||||
|
|
||||||
build-windows-package:
|
build-windows-package:
|
||||||
needs:
|
needs:
|
||||||
- setup
|
- setup
|
||||||
@@ -173,3 +190,19 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
package-file-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-package-file-name-prefix }}
|
package-file-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-package-file-name-prefix }}
|
||||||
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
||||||
|
|
||||||
|
build-macos-package:
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
- build-macos-backend
|
||||||
|
- build-linux-docker-and-package-x86
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- uses: ./.github/actions/build-macos-package
|
||||||
|
with:
|
||||||
|
architecture: arm64
|
||||||
|
package-file-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-package-file-name-prefix }}
|
||||||
|
backend-artifact-name-prefix: ${{ needs.setup.outputs.ezbookkeeping-backend-artifact-name-prefix }}
|
||||||
|
|||||||
@@ -160,6 +160,12 @@ build_backend() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ld_static_link_flags=""
|
||||||
|
|
||||||
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
|
ld_static_link_flags="-linkmode external -extldflags '-static'"
|
||||||
|
fi
|
||||||
|
|
||||||
backend_build_extra_arguments="-X main.Version=$VERSION"
|
backend_build_extra_arguments="-X main.Version=$VERSION"
|
||||||
backend_build_extra_arguments="$backend_build_extra_arguments -X main.CommitHash=$COMMIT_HASH"
|
backend_build_extra_arguments="$backend_build_extra_arguments -X main.CommitHash=$COMMIT_HASH"
|
||||||
|
|
||||||
@@ -169,7 +175,7 @@ build_backend() {
|
|||||||
|
|
||||||
echo "Building backend binary file ($RELEASE_TYPE)..."
|
echo "Building backend binary file ($RELEASE_TYPE)..."
|
||||||
|
|
||||||
CGO_ENABLED=1 go build -a -v -trimpath -ldflags "-w -s -linkmode external -extldflags '-static' $backend_build_extra_arguments" -o ezbookkeeping ezbookkeeping.go
|
CGO_ENABLED=1 go build -a -v -trimpath -ldflags "-w -s $ld_static_link_flags $backend_build_extra_arguments" -o ezbookkeeping ezbookkeeping.go
|
||||||
chmod +x ezbookkeeping
|
chmod +x ezbookkeeping
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user