-
Notifications
You must be signed in to change notification settings - Fork 29
165 lines (140 loc) · 6.02 KB
/
release.yaml
File metadata and controls
165 lines (140 loc) · 6.02 KB
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
163
164
165
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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: retrieve dockerhub credentials
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD
- name: Log in to Docker Hub
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Install Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version: 'stable'
cache: 'false'
- name: Install Dependencies
run: |
go install github.com/magefile/mage@v1.15.0
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0
- 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 -NanoServerVersion "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-using-2025:
runs-on: windows-2025
env:
REPO: rancher
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: retrieve dockerhub credentials
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD
- name: Log in to Docker Hub
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
# This step is required otherwise the 'mage'
# command cannot be used in subsequent steps
- name: Install Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version: 'stable'
cache: 'false'
- name: Install Dependencies
run: |
go install github.com/magefile/mage@v1.15.0
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0
- 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 -NanoServerVersion "ltsc2019" -Repo "${{ env.REPO }}" -Tag "${{ env.TAG }}"
- name: push images
run: |
docker push ${{ env.REPO }}/wins:${{ env.TAG }}-windows-ltsc2019
create-github-release:
needs: [ create-push-image-windows-2019-using-2025, 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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version: 'stable'
- name: Install Dependencies
run: |
go install github.com/magefile/mage@v1.15.0
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0
- 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-using-2025, 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/rancher/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD
- name: Log in to Docker Hub
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
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-ltsc2019
docker manifest push ${{ env.REPO }}/wins:${{ env.TAG }}