forked from funkypenguin/fdb-kubernetes-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (132 loc) · 4.99 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
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
128
129
130
131
132
133
name: Create Release
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
tag: ${{ steps.get_tag.outputs.TAG }}
steps:
- uses: actions/checkout@v2
- name: Get the tag without ref
id: get_tag
run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
- name: Ensure changelog file exists
run: touch ./docs/changelog/${{ steps.get_tag.outputs.TAG }}.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
# Otherwise we can't rerun this to build new binaries
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
body_path: ./docs/changelog/${{ steps.get_tag.outputs.TAG }}.md
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
release-plugin:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
# - windows-latest
- ubuntu-latest
- macOS-latest
needs: create-release
steps:
- uses: actions/checkout@v2
- name: Set package name
id: set_package_name
run: echo ::set-output name=package_name::kubectl-fdb-${{ needs.create-release.outputs.tag }}-$(echo ${RUNNER_OS} | tr [:upper:] [:lower:])
- name: Set up Go 1.15
uses: actions/setup-go@v1
with:
go-version: 1.15
- name: Get FDB client
if: runner.os != 'Windows'
env:
FDB_VER: "6.2.29"
run: |
go get -v -t -d ./...
if [[ "${RUNNER_OS}" == "macOS" ]];then
curl --fail "https://www.foundationdb.org/downloads/${FDB_VER}/macOS/installers/FoundationDB-${FDB_VER}.pkg" -o fdb.pkg
sudo installer -allowUntrusted -verbose -pkg ./fdb.pkg -target /
# required later for calculating the sha256
brew install coreutils
else
curl --fail "https://www.foundationdb.org/downloads/${FDB_VER}/ubuntu/installers/foundationdb-clients_${FDB_VER}-1_amd64.deb" -o fdb.deb
sudo dpkg -i fdb.deb
fi
# - name: Get FDB client (windows-only)
# if: runner.os == 'Windows'
# shell: powershell
# run: |
# Invoke-WebRequest -OutFile fdb.msi -Uri https://www.foundationdb.org/downloads/6.2.28/windows/installers/foundationdb-6.2.28-x64.msi
# msiexec /i "fdb.msi"
# go get -v -t -d ./...
- name: Build
run: TAG=${{ needs.create-release.outputs.tag }} make plugin package
- name: Test binary
run: ./bin/kubectl-fdb version --client-only
- name: Create sha256 for assert
run: |
cp ./bin/kubectl-fdb ${{ steps.set_package_name.outputs.package_name }}
sha256sum ${{ steps.set_package_name.outputs.package_name }} > ./bin/${{ steps.set_package_name.outputs.package_name }}.sha256
- name: Upload Release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./bin/kubectl-fdb
asset_name: ${{ steps.set_package_name.outputs.package_name }}
asset_content_type: application/octet-stream
- name: Upload sha256 for asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./bin/${{ steps.set_package_name.outputs.package_name }}.sha256
asset_name: ${{ steps.set_package_name.outputs.package_name }}.sha256
asset_content_type: text/plain
push_images:
name: Push Docker images
needs: create-release
runs-on: ubuntu-latest
strategy:
matrix:
image:
- fdb-kubernetes-operator
- fdb-data-loader
include:
- image: fdb-kubernetes-operator
context: ./
name: foundationdb/fdb-kubernetes-operator
- image: fdb-data-loader
context: ./sample-apps/data-loader
name: foundationdb/fdb-data-loader
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Get the version
id: get_tag
run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push to registry
uses: docker/build-push-action@v2
with:
push: true
context: ${{ matrix.context }}
tags: ${{ matrix.name }}:${{ steps.get_tag.outputs.TAG }}