Skip to content

Commit 70bd4a9

Browse files
nyodasAlexB138
authored andcommitted
[ci] - Add github action (#26)
1 parent 0d00ef6 commit 70bd4a9

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

.github/workflows/dd-build.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Build and Push k8s Release
2+
3+
on:
4+
push:
5+
# Sequence of patterns matched against refs/heads
6+
tags:
7+
# Push events on datadog tags
8+
- "*-dd*"
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
platform: ["linux/arm64","linux/amd64"]
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
- name: Set up Go
20+
uses: actions/setup-go@v2
21+
with:
22+
go-version: 1.15
23+
- name: Build
24+
env:
25+
KUBE_BUILD_PLATFORMS: ${{ matrix.platform }}
26+
KUBE_RELEASE_RUN_TESTS: n
27+
run: make quick-release KUBE_BUILD_PLATFORMS=$KUBE_BUILD_PLATFORMS
28+
- uses: actions/upload-artifact@v2
29+
with:
30+
name: k8s_output
31+
path: _output/release-tars
32+
release:
33+
runs-on: ubuntu-latest
34+
needs: build
35+
outputs:
36+
upload_url: ${{ steps.create_release_branch.outputs.upload_url }}${{ steps.create_release_tags.outputs.upload_url }}
37+
steps:
38+
- name: Extract branch name
39+
shell: bash
40+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
41+
id: extract_branch
42+
env:
43+
GITHUB_REF: ${{ github.ref }}
44+
if: startsWith(github.ref, 'refs/heads/')
45+
- name: Create Release for Branch
46+
id: create_release_branch
47+
uses: actions/create-release@v1
48+
if: startsWith(github.ref, 'refs/heads/')
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
with:
52+
tag_name: branch@${{ steps.extract_branch.outputs.branch }}
53+
release_name: branch@${{ steps.extract_branch.outputs.branch }}
54+
draft: false
55+
prerelease: false
56+
57+
- name: Extract tags name
58+
shell: bash
59+
run: echo "##[set-output name=tags;]$(echo ${GITHUB_REF#refs/tags/})"
60+
id: extract_tags
61+
env:
62+
GITHUB_REF: ${{ github.ref }}
63+
if: startsWith(github.ref, 'refs/tags/')
64+
- name: Create Release for Tags
65+
id: create_release_tags
66+
uses: actions/create-release@v1
67+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
with:
71+
tag_name: ${{ steps.extract_tags.outputs.tags }}
72+
release_name: ${{ steps.extract_tags.outputs.tags }}
73+
draft: false
74+
prerelease: false
75+
releaseassetsarm:
76+
runs-on: ubuntu-latest
77+
needs: release
78+
strategy:
79+
matrix:
80+
assets: [
81+
"kubernetes-client",
82+
"kubernetes-node",
83+
"kubernetes-server"
84+
]
85+
platform: ["linux-arm64","linux-amd64"]
86+
steps:
87+
- uses: actions/download-artifact@v2
88+
with:
89+
name: k8s_output
90+
path: _output/release-tars
91+
- name: Display structure of downloaded files
92+
run: ls -R
93+
working-directory: _output
94+
- name: Upload Release Asset
95+
id: upload-release-asset
96+
uses: actions/upload-release-asset@v1
97+
env:
98+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
with:
100+
upload_url: ${{ needs.release.outputs.upload_url }}
101+
asset_path: ./_output/release-tars/${{ matrix.assets }}-${{ matrix.platform }}.tar.gz
102+
asset_name: ${{ matrix.assets }}-${{ matrix.platform }}.tar.gz
103+
asset_content_type: application/tar+gzip

0 commit comments

Comments
 (0)