From 6243adbd8d4472be172a42bb3952d6ed757d397c Mon Sep 17 00:00:00 2001 From: networkop Date: Wed, 3 Feb 2021 16:23:50 +0000 Subject: [PATCH] Added docker auto-release to CI --- .github/workflows/docker.yml | 33 +++++++++++++++++++++++++++ .github/workflows/release.yml | 43 +++++++++++++++++++++++++++++++++++ .goreleaser.yml | 14 ++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 .github/workflows/docker.yml create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..ab7c3e4 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,33 @@ +name: docker + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + docker: + strategy: + matrix: + go-version: [1.15.x] + os: [ubuntu-20.04] + runs-on: ${{ matrix.os }} + steps: + - + name: Checkout code + uses: actions/checkout@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to Container Registry + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.DOCKER_LOGIN }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Build and Push container images + run: | + make docker \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c9bb2d5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: release + +on: + push: + tags: + - '*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to Container Registry + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.DOCKER_LOGIN }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Build and Push container images + run: | + make release \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..1722f7b --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,14 @@ +before: + hooks: + - go mod download +builds: + - id: coredns + main: ./cmd/coredns.go + binary: coredns + env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 + - arm64