Skip to content

Commit

Permalink
add: workflow build docker image
Browse files Browse the repository at this point in the history
Signed-off-by: MicroOps <[email protected]>
  • Loading branch information
MicroOps-cn committed Oct 24, 2024
1 parent 702f41d commit d5a3c52
Showing 1 changed file with 38 additions and 9 deletions.
47 changes: 38 additions & 9 deletions .github/workflows/github-actions-build.yaml
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
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d5a3c52

Please sign in to comment.