-
Notifications
You must be signed in to change notification settings - Fork 563
116 lines (100 loc) · 3.45 KB
/
release.yml
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
name: release
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: The tag to run against. This trigger only runs the MSI builder.
required: true
jobs:
release:
name: release
strategy:
# the goreleaser and the Github release API doesn't handle concurrent
# access well, so run goreleaser serially
max-parallel: 1
matrix:
os:
- ubuntu-latest
- ubuntu-20.04
- macos-latest
runs-on: ${{ matrix.os }}
if: github.event_name != 'workflow_dispatch'
permissions: write-all
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: 1.20.x
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Install dependency required for linux builds
if: matrix.os == 'ubuntu-20.04'
run: sudo apt-get update && sudo apt-get install -y libudev-dev
- name: Add Lowercase Repository Name to Environment
run: |
echo REPOSITORY_NAME_LOWERCASE=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- uses: "docker/login-action@v2"
if: matrix.os == 'ubuntu-20.04'
with:
registry: "ghcr.io"
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean --config .goreleaser.${{ matrix.os }}.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_NAME: ${{ env.REPOSITORY_NAME_LOWERCASE }}
windows-msi:
name: Build Windows MSI and upload to release
runs-on: ubuntu-latest
permissions:
contents: write
needs: [release]
if: >- # https://github.com/actions/runner/issues/491
always() &&
(needs.release.result == 'success' || needs.release.result == 'skipped')
env:
INSTALLER: ${{ github.workspace }}/.github/win-msi
BIN: ${{ github.workspace }}/.github/win-msi/src/bin
WIXIMG: dactiv/wix@sha256:17d232708589641f5632f9a1ff9463ad087b192cea7b8e6012d2b47ec6af5f6c
steps:
- name: Normalize tag values
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] ; then
VER=${{ github.event.inputs.tag }}
else
VER=${GITHUB_REF/refs\/tags\//}
fi
VERSION=${VER//v}
echo "VER_TAG=$VER" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "ASSET=saml2aws_${VERSION}_windows_amd64.zip" >> $GITHUB_ENV
- name: Check out code
uses: actions/checkout@v4
- name: Retrieve the release asset
id: asset
uses: robinraju/release-downloader@efa4cd07bd0195e6cc65e9e30c251b49ce4d3e51 # v1.8
with:
repository: ${{ github.repository }}
tag: ${{ env.VER_TAG }}
fileName: ${{ env.ASSET }}
out-file-path: ${{ env.BIN }}
- name: Unzip asset
working-directory: ${{ env.BIN }}
run: unzip "${ASSET}"
- name: Build MSI
run: |
# container does not run as root
chmod -R o+rw "${INSTALLER}"
cat "${INSTALLER}/wix.sh" | docker run --rm -i -e VERSION -v "${INSTALLER}:/wix" ${WIXIMG} /bin/sh
- name: Upload the asset to the release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 / v1
with:
tag_name: ${{ env.VER_TAG }}
files: ${{ env.INSTALLER }}/out/*.msi