-
Notifications
You must be signed in to change notification settings - Fork 18
76 lines (68 loc) · 2.35 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
name: Release
on:
workflow_run:
types:
- completed
workflows:
- "ci"
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && contains(github.event.workflow_run.head_branch, 'release/') }}
outputs:
tag: ${{ needs.check-gomod-deps.outputs.tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: refs/heads/${{github.event.workflow_run.head_branch}}
- name: Push tag ${{ needs.check-gomod-deps.outputs.tag }}
run: |
git status
git tag ${{ needs.check-gomod-deps.outputs.tag }}
git push origin ${{ needs.check-gomod-deps.outputs.tag }} -f
- name: Create release ${{ needs.check-gomod-deps.outputs.tag }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
with:
tag_name: refs/tags/${{ needs.check-gomod-deps.outputs.tag }}
release_name: ${{ needs.check-gomod-deps.outputs.tag }}
draft: false
prerelease: false
docker:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && contains(github.event.workflow_run.head_branch, 'release/') }}
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
ref: refs/heads/${{github.event.workflow_run.head_branch}}
- uses: actions/setup-go@v1
with:
go-version: 1.17
- name: "Build coredns binary"
run: |
go build -o coredns/coredns coredns/main.go
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v1
- name: "Login to GitHub Container Registry"
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get tag
run: |
branch=${{github.event.workflow_run.head_branch}}
echo '::set-output name=tag::'${branch#release/}
id: get-tag-step
- name: "Build and push"
uses: docker/build-push-action@v2
with:
file: coredns/Dockerfile
context: .
push: true
tags: "ghcr.io/${{ github.repository_owner }}/coredns:${{ steps.get-tag-step.outputs.tag }}"