-
Notifications
You must be signed in to change notification settings - Fork 23
162 lines (139 loc) · 5.68 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Release
on:
push:
tags:
- '*'
jobs:
create-push-image-windows-2022:
runs-on: windows-2022
env:
REPO: rancher
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v1
- name: retrieve dockerhub credentials
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/credentials password | DOCKER_PASSWORD
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Install Dependencies
run: |
go install github.com/magefile/[email protected]
go install github.com/golangci/golangci-lint/cmd/[email protected]
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: build-binary
run: |
set PSModulePath=&&powershell -command "mage ci"
# Note: We cannot use the docker/build-push-action as it requires dependencies
# which cannot be installed onto windows VMs. Additionally, it is not possible to cross compile
# Windows images on linux. So, we're stuck with manual docker commands.
- name: Build Windows 2022
run: ./scripts/build-image.ps1 -ServerCoreVersion "ltsc2022" -Repo "${{ env.REPO }}" -Tag "${{ env.TAG }}"
- name: push images
run: |
docker push ${{ env.REPO }}/wins:${{ env.TAG }}-windows-ltsc2022
create-push-image-windows-2019:
# Due to limitations on the number of free runners in the Rancher org (20)
# we do not build 2019 and 2022 in parallel
needs: [create-push-image-windows-2022]
runs-on: windows-2019
env:
REPO: rancher
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v1
- name: retrieve dockerhub credentials
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/credentials password | DOCKER_PASSWORD
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Install Dependencies
run: |
go install github.com/magefile/[email protected]
go install github.com/golangci/golangci-lint/cmd/[email protected]
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: build-binary
run: |
set PSModulePath=&&powershell -command "mage ci"
# Note: We cannot use the docker/build-push-action as it requires dependencies
# which cannot be installed onto windows VMs. Additionally, it is not possible to cross compile
# Windows images on linux. So, we're stuck with manual docker commands.
- name: Build Windows 2019
run: ./scripts/build-image.ps1 -ServerCoreVersion "1809" -Repo "${{ env.REPO }}" -Tag "${{ env.TAG }}"
- name: push images
run: |
docker push ${{ env.REPO }}/wins:${{ env.TAG }}-windows-1809
create-github-release:
needs: [ create-push-image-windows-2019, create-push-image-windows-2022 ]
runs-on: windows-2022
permissions:
contents: write # required for writing release artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Install Dependencies
run: |
go install github.com/magefile/[email protected]
go install github.com/golangci/golangci-lint/cmd/[email protected]
- name: build-binary
run: |
set PSModulePath=&&powershell -command "mage ci"
- name: Create GH Release
run: gh release create ${{ env.TAG }} --verify-tag --generate-notes .\artifacts\wins.exe .\artifacts\sha256.txt .\artifacts\sha512.txt LICENSE
create-manifest:
needs: [ create-push-image-windows-2019, create-push-image-windows-2022 ]
permissions:
id-token: write
env:
REPO: rancher
TAG: ${{ github.ref_name }}
runs-on: ubuntu-latest
steps:
- name: retrieve dockerhub credentials
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/credentials password | DOCKER_PASSWORD
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: create manifest list
run: |
docker manifest create ${{ env.REPO }}/wins:${{ env.TAG }} ${{ env.REPO }}/wins:${{ env.TAG }}-windows-ltsc2022 ${{ env.REPO }}/wins:${{ env.TAG }}-windows-1809
docker manifest push ${{ env.REPO }}/wins:${{ env.TAG }}