forked from microsoft/windows-container-networking
-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (112 loc) · 3.9 KB
/
release.yml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
on:
push:
branches:
- main
- "release/**"
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches:
- main
- "release/**"
name: Release
env:
GO_VERSION: "1.21.0"
BINARY_ARTEFACT_NAME: "windows-cni-binaries"
RELEASE_NOTEST_ARTEFACT_NAME: "windows-cni-release-notes"
permissions:
contents: read
jobs:
check:
name: Check Signed Tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-20.04
timeout-minutes: 5
outputs:
stringver: ${{ steps.contentrel.outputs.stringver }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
path: src/github.com/Microsoft/windows-container-networking
- name: Log tag signed
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
TAGCHECK=$(git tag -v ${releasever} 2>&1 >/dev/null) ||
echo "${TAGCHECK}" | grep -q "error" && {
echo "::error::tag ${releasever} is not a signed tag!"
} || {
echo "Tag ${releasever} is signed."
}
working-directory: src/github.com/Microsoft/windows-container-networking
- name: Release content
id: contentrel
run: |
RELEASEVER=${{ github.ref }}
echo "stringver=${RELEASEVER#refs/tags/v}" >> $GITHUB_OUTPUT
git tag -l ${RELEASEVER#refs/tags/} -n20000 | tail -n +3 | cut -c 5- >release-notes.md
working-directory: src/github.com/Microsoft/windows-container-networking
- name: Save release notes
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_NOTEST_ARTEFACT_NAME }}
path: src/github.com/Microsoft/windows-container-networking/release-notes.md
build:
name: Build Release Binaries
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Set RELEASE_VER
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
# Intentionally use github.repository instead of Microsoft/windows-container-networking to
# make this action runnable on forks.
repository: ${{ github.repository }}
ref: ${{ github.ref }}
path: src/github.com/Microsoft/windows-container-networking
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Make
shell: bash
run: |
make all
working-directory: src/github.com/Microsoft/windows-container-networking
- name: Save Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.BINARY_ARTEFACT_NAME }}
path: src/github.com/Microsoft/windows-container-networking/out/*
release:
name: Create CNI Binaries Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
runs-on: ubuntu-22.04
timeout-minutes: 10
needs: [build, check]
steps:
- name: Download builds and release notes
uses: actions/download-artifact@v3
with:
path: builds
- name: Create Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
fail_on_unmatched_files: true
name: windows-cni ${{ needs.check.outputs.stringver }}
draft: false
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
body_path: ./builds/${{ env.RELEASE_NOTEST_ARTEFACT_NAME }}/release-notes.md
files: |
builds/${{ env.BINARY_ARTEFACT_NAME }}/*