Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 46 additions & 25 deletions .github/workflows/binary-dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:

jobs:
resolve-dev-name:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
outputs:
specific_name: ${{ steps.dev_name.outputs.specific_name }}
steps:
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
echo "Using specific binary package name: $specific_name"

binary-dev-linux:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: resolve-dev-name
strategy:
fail-fast: false
Expand All @@ -77,13 +77,14 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.22'
go-version: stable
check-latest: true
cache: true

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
node-version: '24'
cache: npm
cache-dependency-path: web/package-lock.json

Expand Down Expand Up @@ -117,7 +118,7 @@ jobs:
tar -czf "dist/${package_name}.tar.gz" -C dist "${package_name}"

- name: Upload binary package artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: cpa-usage-keeper-dev-${{ needs.resolve-dev-name.outputs.specific_name }}-${{ matrix.goos }}-${{ matrix.asset_arch }}
path: dist/cpa-usage-keeper_dev_${{ needs.resolve-dev-name.outputs.specific_name }}_*_${{ matrix.goos }}_${{ matrix.asset_arch }}.tar.gz
Expand All @@ -133,25 +134,26 @@ jobs:
- goos: darwin
goarch: amd64
asset_arch: amd64
runs_on: macos-13
runs_on: macos-15-intel
- goos: darwin
goarch: arm64
asset_arch: arm64
runs_on: macos-14
runs_on: macos-15
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.22'
go-version: stable
check-latest: true
cache: true

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
node-version: '24'
cache: npm
cache-dependency-path: web/package-lock.json

Expand Down Expand Up @@ -181,39 +183,56 @@ jobs:
tar -czf "dist/${package_name}.tar.gz" -C dist "${package_name}"

- name: Upload binary package artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: cpa-usage-keeper-dev-${{ needs.resolve-dev-name.outputs.specific_name }}-${{ matrix.goos }}-${{ matrix.asset_arch }}
path: dist/cpa-usage-keeper_dev_${{ needs.resolve-dev-name.outputs.specific_name }}_*_${{ matrix.goos }}_${{ matrix.asset_arch }}.tar.gz
if-no-files-found: error

binary-dev-windows:
runs-on: windows-latest
runs-on: ${{ matrix.runs_on }}
needs: resolve-dev-name
strategy:
fail-fast: false
matrix:
include:
- goarch: amd64
asset_arch: amd64
runs_on: windows-2025
msystem: UCRT64
install: mingw-w64-ucrt-x86_64-gcc
cc: gcc
- goarch: arm64
asset_arch: arm64
runs_on: windows-11-arm
msystem: CLANGARM64
install: mingw-w64-clang-aarch64-gcc
cc: gcc
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.22'
go-version: stable
check-latest: true
cache: true

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
node-version: '24'
cache: npm
cache-dependency-path: web/package-lock.json

- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
msystem: ${{ matrix.msystem }}
update: true
path-type: inherit
install: mingw-w64-ucrt-x86_64-gcc
install: ${{ matrix.install }}

- name: Install frontend dependencies
shell: bash
Expand All @@ -228,15 +247,16 @@ jobs:
env:
PACKAGE_SUFFIX: ${{ needs.resolve-dev-name.outputs.specific_name }}
GOOS: windows
GOARCH: amd64
ASSET_ARCH: amd64
GOARCH: ${{ matrix.goarch }}
ASSET_ARCH: ${{ matrix.asset_arch }}
CC: ${{ matrix.cc }}
run: |
set -euo pipefail
package_name="cpa-usage-keeper_dev_${PACKAGE_SUFFIX}_${GITHUB_SHA::7}_${GOOS}_${ASSET_ARCH}"
package_dir="dist/${package_name}"
mkdir -p "${package_dir}/web" "${package_dir}/data"

CGO_ENABLED=1 GOOS="${GOOS}" GOARCH="${GOARCH}" CC=gcc \
CGO_ENABLED=1 GOOS="${GOOS}" GOARCH="${GOARCH}" CC="${CC}" \
go build -trimpath -ldflags="-s -w" -o "${package_dir}/cpa-usage-keeper.exe" ./cmd/server/main.go

cp -R web/dist "${package_dir}/web/dist"
Expand All @@ -246,28 +266,29 @@ jobs:
shell: pwsh
env:
PACKAGE_SUFFIX: ${{ needs.resolve-dev-name.outputs.specific_name }}
ASSET_ARCH: ${{ matrix.asset_arch }}
run: |
$shortSha = "${env:GITHUB_SHA}".Substring(0, 7)
$packageName = "cpa-usage-keeper_dev_${env:PACKAGE_SUFFIX}_${shortSha}_windows_amd64"
$packageName = "cpa-usage-keeper_dev_${env:PACKAGE_SUFFIX}_${shortSha}_windows_${env:ASSET_ARCH}"
Compress-Archive -Path "dist/$packageName" -DestinationPath "dist/$packageName.zip"

- name: Upload binary package artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: cpa-usage-keeper-dev-${{ needs.resolve-dev-name.outputs.specific_name }}-windows-amd64
path: dist/cpa-usage-keeper_dev_${{ needs.resolve-dev-name.outputs.specific_name }}_*_windows_amd64.zip
name: cpa-usage-keeper-dev-${{ needs.resolve-dev-name.outputs.specific_name }}-windows-${{ matrix.asset_arch }}
path: dist/cpa-usage-keeper_dev_${{ needs.resolve-dev-name.outputs.specific_name }}_*_windows_${{ matrix.asset_arch }}.zip
if-no-files-found: error

publish-dev-artifacts:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs:
- resolve-dev-name
- binary-dev-linux
- binary-dev-darwin
- binary-dev-windows
steps:
- name: Download binary package artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v6
with:
path: dist
merge-multiple: true
Expand All @@ -279,7 +300,7 @@ jobs:
sha256sum *.tar.gz *.zip > checksums.txt

- name: Upload dev binary packages
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: cpa-usage-keeper-dev-binaries-${{ github.run_id }}
path: |
Expand Down
69 changes: 45 additions & 24 deletions .github/workflows/binary-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:

jobs:
binary-release-linux:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
Expand All @@ -30,13 +30,14 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.22'
go-version: stable
check-latest: true
cache: true

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
node-version: '24'
cache: npm
cache-dependency-path: web/package-lock.json

Expand Down Expand Up @@ -70,7 +71,7 @@ jobs:
tar -czf "dist/${package_name}.tar.gz" -C dist "${package_name}"

- name: Upload binary package artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: cpa-usage-keeper-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.asset_arch }}
path: dist/cpa-usage-keeper_${{ github.ref_name }}_${{ matrix.goos }}_${{ matrix.asset_arch }}.tar.gz
Expand All @@ -85,25 +86,26 @@ jobs:
- goos: darwin
goarch: amd64
asset_arch: amd64
runs_on: macos-13
runs_on: macos-15-intel
- goos: darwin
goarch: arm64
asset_arch: arm64
runs_on: macos-14
runs_on: macos-15
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.22'
go-version: stable
check-latest: true
cache: true

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
node-version: '24'
cache: npm
cache-dependency-path: web/package-lock.json

Expand Down Expand Up @@ -133,38 +135,55 @@ jobs:
tar -czf "dist/${package_name}.tar.gz" -C dist "${package_name}"

- name: Upload binary package artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: cpa-usage-keeper-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.asset_arch }}
path: dist/cpa-usage-keeper_${{ github.ref_name }}_${{ matrix.goos }}_${{ matrix.asset_arch }}.tar.gz
if-no-files-found: error

binary-release-windows:
runs-on: windows-latest
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
include:
- goarch: amd64
asset_arch: amd64
runs_on: windows-2025
msystem: UCRT64
install: mingw-w64-ucrt-x86_64-gcc
cc: gcc
- goarch: arm64
asset_arch: arm64
runs_on: windows-11-arm
msystem: CLANGARM64
install: mingw-w64-clang-aarch64-gcc
cc: gcc
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.22'
go-version: stable
check-latest: true
cache: true

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
node-version: '24'
cache: npm
cache-dependency-path: web/package-lock.json

- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
msystem: ${{ matrix.msystem }}
update: true
path-type: inherit
install: mingw-w64-ucrt-x86_64-gcc
install: ${{ matrix.install }}

- name: Install frontend dependencies
shell: bash
Expand All @@ -179,15 +198,16 @@ jobs:
env:
VERSION: ${{ github.ref_name }}
GOOS: windows
GOARCH: amd64
ASSET_ARCH: amd64
GOARCH: ${{ matrix.goarch }}
ASSET_ARCH: ${{ matrix.asset_arch }}
CC: ${{ matrix.cc }}
run: |
set -euo pipefail
package_name="cpa-usage-keeper_${VERSION}_${GOOS}_${ASSET_ARCH}"
package_dir="dist/${package_name}"
mkdir -p "${package_dir}/web" "${package_dir}/data"

CGO_ENABLED=1 GOOS="${GOOS}" GOARCH="${GOARCH}" CC=gcc \
CGO_ENABLED=1 GOOS="${GOOS}" GOARCH="${GOARCH}" CC="${CC}" \
go build -trimpath -ldflags="-s -w" -o "${package_dir}/cpa-usage-keeper.exe" ./cmd/server/main.go

cp -R web/dist "${package_dir}/web/dist"
Expand All @@ -197,26 +217,27 @@ jobs:
shell: pwsh
env:
VERSION: ${{ github.ref_name }}
ASSET_ARCH: ${{ matrix.asset_arch }}
run: |
$packageName = "cpa-usage-keeper_${env:VERSION}_windows_amd64"
$packageName = "cpa-usage-keeper_${env:VERSION}_windows_${env:ASSET_ARCH}"
Compress-Archive -Path "dist/$packageName" -DestinationPath "dist/$packageName.zip"

- name: Upload binary package artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: cpa-usage-keeper-${{ github.ref_name }}-windows-amd64
path: dist/cpa-usage-keeper_${{ github.ref_name }}_windows_amd64.zip
name: cpa-usage-keeper-${{ github.ref_name }}-windows-${{ matrix.asset_arch }}
path: dist/cpa-usage-keeper_${{ github.ref_name }}_windows_${{ matrix.asset_arch }}.zip
if-no-files-found: error

publish-release:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs:
- binary-release-linux
- binary-release-darwin
- binary-release-windows
steps:
- name: Download binary package artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v6
with:
path: dist
merge-multiple: true
Expand All @@ -228,7 +249,7 @@ jobs:
sha256sum *.tar.gz *.zip > checksums.txt

- name: Upload release assets
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
with:
files: |
dist/*.tar.gz
Expand Down
Loading
Loading