-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: MicroOps <[email protected]>
- Loading branch information
1 parent
702f41d
commit d5a3c52
Showing
1 changed file
with
38 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,61 @@ | ||
name: Build | ||
run-name: ${{ github.actor }} is build image 🚀 | ||
on: [push] | ||
on: [ push ] | ||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
jobs: | ||
build-ui: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: Build | ||
run: make ui | ||
|
||
- name: Upload UI artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ui-${{ github.run_id }} | ||
path: pkg/transport/static | ||
if-no-files-found: error | ||
retention-days: 1 | ||
build-image: | ||
needs: | ||
- build-image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
strategy: | ||
matrix: | ||
OS: [linux, darwin] # 操作系统 | ||
ARCH: [amd64, arm64] # 架构 | ||
OS: [ linux, darwin ] # 操作系统 | ||
ARCH: [ amd64, arm64 ] # 架构 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Download UI artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: pkg/transport/static | ||
pattern: ui-${{ github.run_id }} | ||
- name: Check UI artifact | ||
run: | | ||
if [ ! -d pkg/transport/static ] || [ ! -f "pkg/transport/static/index.html" ] || [ ! -f "pkg/transport/static/logo.svg" ]; then | ||
ls -al pkg/transport/static | ||
echo "UI artifact not found" | ||
exit 1 | ||
fi | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.22' | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
# Install the cosign tool except on PR | ||
# https://github.com/sigstore/cosign-installer | ||
- name: Install cosign | ||
|
@@ -63,7 +92,7 @@ jobs: | |
wget -O docker/GeoLite2-City.mmdb.gz -c "https://cdn.jsdelivr.net/npm/[email protected]/GeoLite2-City.mmdb.gz" | ||
gunzip docker/GeoLite2-City.mmdb.gz; | ||
- name: Build binaries | ||
run: make ui idas | ||
run: make idas | ||
env: | ||
GOOS: ${{ matrix.OS }} | ||
GOARCH: ${{ matrix.ARCH }} | ||
|
@@ -109,7 +138,7 @@ jobs: | |
- name: Upload digest | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: digests-${{ env.PLATFORM_PAIR }} | ||
name: digests-${{ github.run_id }}-${{ matrix.OS }}-${{ matrix.ARCH }} | ||
path: /tmp/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
@@ -122,7 +151,7 @@ jobs: | |
uses: actions/download-artifact@v4 | ||
with: | ||
path: /tmp/digests | ||
pattern: digests-* | ||
pattern: digests-${{ github.run_id }} | ||
merge-multiple: true | ||
|
||
- name: Set up Docker Buildx | ||
|