Skip to content

Commit

Permalink
feat: update ci
Browse files Browse the repository at this point in the history
Signed-off-by: wangyizhi1 <[email protected]>
  • Loading branch information
wangyizhi1 committed Oct 9, 2023
1 parent d557367 commit f8fd302
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/push-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
push:
tags:
- "v*.*.*"

jobs:
push-images:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up qemu
uses: docker/setup-qemu-action@v2
- name: Login registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push images
env:
ON_PLUGINS: true
run: |
make upload-images
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@ all: coredns
coredns: $(CHECKS)
CGO_ENABLED=$(CGO_ENABLED) GOOS=${GOOS} GOARCH=${GOARCH} go build $(BUILDOPTS) -ldflags="-s -w -X github.com/coredns/coredns/coremain.GitCommit=$(GITCOMMIT)" -o $(BINARY)

.PHONY: image
image: coredns
.PHONY: images
images: coredns
set -e;\
docker buildx build --output=type=docker --platform ${GOOS}/${GOARCH} --tag ${REGISTRY}/coredns:v${VERSION} .

.PHONY: push-images
upload-images: images
@echo "push images to $(REGISTRY)"
docker push ${REGISTRY}/coredns:${VERSION}

.PHONY: check
check: core/plugin/zplugin.go core/dnsserver/zdirectives.go

Expand Down

0 comments on commit f8fd302

Please sign in to comment.