@@ -3,11 +3,11 @@ name: release
3
3
on :
4
4
push :
5
5
tags :
6
- - ' * '
6
+ - " * "
7
7
workflow_dispatch :
8
8
inputs :
9
9
tag :
10
- description : The tag to run against. This trigger only runs the MSI builder.
10
+ description : The tag to run against. This trigger runs the GoReleaser and MSI builder.
11
11
required : true
12
12
13
13
jobs :
@@ -19,98 +19,102 @@ jobs:
19
19
max-parallel : 1
20
20
matrix :
21
21
os :
22
- - ubuntu-latest
23
- - ubuntu-20.04
24
- - macos-latest
22
+ - ubuntu-latest
23
+ - ubuntu-20.04
24
+ - macos-latest
25
25
runs-on : ${{ matrix.os }}
26
26
if : github.event_name != 'workflow_dispatch'
27
27
permissions : write-all
28
28
steps :
29
-
30
- - name : Set up Go 1.x
31
- uses : actions/setup-go@v5
32
- with :
33
- go-version : 1.21.x
34
-
35
- - name : Check out code into the Go module directory
36
- uses : actions/checkout@v4
37
-
38
- - name : Install dependency required for linux builds
39
- if : matrix.os == 'ubuntu-20.04'
40
- run : sudo apt-get update && sudo apt-get install -y libudev-dev
41
-
42
- - name : Add Lowercase Repository Name to Environment
43
- run : |
44
- echo REPOSITORY_NAME_LOWERCASE=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
45
-
46
- - uses : " docker/login-action@v3"
47
- if : matrix.os == 'ubuntu-20.04'
48
- with :
49
- registry : " ghcr.io"
50
- username : " ${{ github.actor }}"
51
- password : " ${{ secrets.GITHUB_TOKEN }}"
52
- - name : GoReleaser
53
- uses : goreleaser/goreleaser-action@v6
54
- with :
55
- version : latest
56
- args : release --clean --config .goreleaser.${{ matrix.os }}.yml
57
- env :
58
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
59
- IMAGE_NAME : ${{ env.REPOSITORY_NAME_LOWERCASE }}
29
+ - name : Check out code into the Go module directory
30
+ uses : actions/checkout@v4
31
+ with :
32
+ fetch-depth : 0
33
+
34
+ - name : Set up Go 1.x
35
+ uses : actions/setup-go@v5
36
+ with :
37
+ go-version-file : " go.mod"
38
+
39
+ - name : Install dependency required for linux builds
40
+ if : matrix.os == 'ubuntu-20.04'
41
+ run : sudo apt-get update && sudo apt-get install -y libudev-dev
42
+
43
+ - name : Add Lowercase Repository Name to Environment
44
+ run : |
45
+ echo REPOSITORY_NAME_LOWERCASE=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
46
+
47
+ - uses : " docker/login-action@v3"
48
+ if : matrix.os == 'ubuntu-20.04'
49
+ with :
50
+ registry : " ghcr.io"
51
+ username : " ${{ github.actor }}"
52
+ password : " ${{ secrets.GITHUB_TOKEN }}"
53
+
54
+ - name : GoReleaser
55
+ uses : goreleaser/goreleaser-action@v6
56
+ with :
57
+ version : latest
58
+ args : release --clean --config .goreleaser.${{ matrix.os }}.yml
59
+ env :
60
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
61
+ IMAGE_NAME : ${{ env.REPOSITORY_NAME_LOWERCASE }}
60
62
61
63
windows-msi :
62
64
name : Build Windows MSI and upload to release
63
65
runs-on : ubuntu-latest
64
66
permissions :
65
67
contents : write
66
68
needs : [release]
67
- if : >- # https://github.com/actions/runner/issues/491
69
+ if : >- # https://github.com/actions/runner/issues/491
68
70
always() &&
69
71
(needs.release.result == 'success' || needs.release.result == 'skipped')
70
72
env :
71
73
INSTALLER : ${{ github.workspace }}/.github/win-msi
72
74
BIN : ${{ github.workspace }}/.github/win-msi/src/bin
73
75
WIXIMG : dactiv/wix@sha256:17d232708589641f5632f9a1ff9463ad087b192cea7b8e6012d2b47ec6af5f6c
74
76
steps :
75
- - name : Normalize tag values
76
- run : |
77
- if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] ; then
78
- VER=${{ github.event.inputs.tag }}
79
- else
80
- VER=${GITHUB_REF/refs\/tags\//}
81
- fi
82
-
83
- VERSION=${VER//v}
84
-
85
- echo "VER_TAG=$VER" >> $GITHUB_ENV
86
- echo "VERSION=$VERSION" >> $GITHUB_ENV
87
- echo "ASSET=saml2aws_${VERSION}_windows_amd64.zip" >> $GITHUB_ENV
88
-
89
- - name : Check out code
90
- uses : actions/checkout@v4
91
-
92
- - name : Retrieve the release asset
93
- id : asset
94
- uses : robinraju/release-downloader@a96f54c1b5f5e09e47d9504526e96febd949d4c2 # v1.11
95
- with :
96
- repository : ${{ github.repository }}
97
- tag : ${{ env.VER_TAG }}
98
- fileName : ${{ env.ASSET }}
99
- out-file-path : ${{ env.BIN }}
100
-
101
- - name : Unzip asset
102
- working-directory : ${{ env.BIN }}
103
- run : unzip "${ASSET}"
104
-
105
- - name : Build MSI
106
- run : |
107
- # container does not run as root
108
- chmod -R o+rw "${INSTALLER}"
109
-
110
- cat "${INSTALLER}/wix.sh" | docker run --rm -i -e VERSION -v "${INSTALLER}:/wix" ${WIXIMG} /bin/sh
111
-
112
- - name : Upload the asset to the release
113
- uses : softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0 # v0.2.0.6.2.0.65 / v2.0.6
114
- with :
115
- tag_name : ${{ env.VER_TAG }}
116
- files : ${{ env.INSTALLER }}/out/*.msi
77
+ - name : Normalize tag values
78
+ run : |
79
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] ; then
80
+ VER=${{ github.event.inputs.tag }}
81
+ else
82
+ VER=${GITHUB_REF/refs\/tags\//}
83
+ fi
84
+
85
+ VERSION=${VER//v}
86
+
87
+ echo "VER_TAG=$VER" >> $GITHUB_ENV
88
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
89
+ echo "ASSET=saml2aws_${VERSION}_windows_amd64.zip" >> $GITHUB_ENV
90
+
91
+ - name : Check out code
92
+ uses : actions/checkout@v4
93
+ with :
94
+ fetch-depth : 0
95
+
96
+ - name : Retrieve the release asset
97
+ id : asset
98
+ uses : robinraju/release-downloader@a96f54c1b5f5e09e47d9504526e96febd949d4c2 # v1.11
99
+ with :
100
+ repository : ${{ github.repository }}
101
+ tag : ${{ env.VER_TAG }}
102
+ fileName : ${{ env.ASSET }}
103
+ out-file-path : ${{ env.BIN }}
104
+
105
+ - name : Unzip asset
106
+ working-directory : ${{ env.BIN }}
107
+ run : unzip "${ASSET}"
108
+
109
+ - name : Build MSI
110
+ run : |
111
+ # container does not run as root
112
+ chmod -R o+rw "${INSTALLER}"
113
+
114
+ cat "${INSTALLER}/wix.sh" | docker run --rm -i -e VERSION -v "${INSTALLER}:/wix" ${WIXIMG} /bin/sh
115
+
116
+ - name : Upload the asset to the release
117
+ uses : softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0 # v0.2.0.6.2.0.65 / v2.0.6
118
+ with :
119
+ tag_name : ${{ env.VER_TAG }}
120
+ files : ${{ env.INSTALLER }}/out/*.msi
0 commit comments