Skip to content

fix: red envelope send issue #334

fix: red envelope send issue

fix: red envelope send issue #334

Workflow file for this run

name: Build Docker Image
on:
push:
branches: [ "master" ]
tags: [ "*" ]
pull_request:
branches: [ "master" ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
# add permission for package publishing
permissions:
contents: read
packages: write
jobs:
build_image:
runs-on: ubuntu-24.04
steps:
# checkout code
- name: Checkout repository
uses: actions/checkout@v4
# set up go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25"
check-latest: true
# download Go modules
- name: Download Go modules
run: go mod download
# build do
- name: Build Go Binary (multi-arch)
run: |
# build amd64 binary
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o credit-server-amd64 main.go
# build arm64 binary
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o credit-server-arm64 main.go
# show binaries
ls -alh credit-server-*
# set up docker buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# login to registry
- name: Log into registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# extract metadata for docker
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=ref,event=tag
type=sha,format=short,prefix=
# build and push docker image
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.ref_type == 'tag' || (github.ref == 'refs/heads/master' && github.event_name == 'push') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64