-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (65 loc) · 2.52 KB
/
build.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
name: Build
on:
workflow_dispatch:
inputs:
version_tag:
description: The version tag to build
required: false
# schedule:
# run M-F, at 12/16/20:00 UTC (7/8am, 11a/12p, 3/4pm EST/EDT)
# - cron: '0 12,16,20 * * 1-5'
# the aws-okta repo is now archived and read-only so unless we start reading from a fork, we don't need a cron
env:
AWS_OKTA_REPOSITORY: https://github.com/segmentio/aws-okta
WIXIMG: dactiv/wix
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Initialize tag via latest release
if: github.event_name != 'workflow_dispatch' || github.event.inputs.version_tag == ''
run: |
VER_TAG=$(basename $(curl -fs -o/dev/null -w %{redirect_url} ${AWS_OKTA_REPOSITORY}/releases/latest))
echo "VER_TAG=${VER_TAG}" >> $GITHUB_ENV
- name: Initialize tag via manual dispatch
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version_tag != ''
run: |
echo "VER_TAG=${{ github.event.inputs.version_tag }}" >> $GITHUB_ENV
- name: Ensure VER_TAG is set
if: ${{ env.VER_TAG == '' }}
run: |
echo "VER_TAG is not set"
exit 1
- name: Checkout
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ^1.13
# this container doesn't run as root, so we allow other to write into the directory
- name: set installer directory permissions
working-directory: installer
run: chmod -R o+rw .
- name: Check for an existing release
run: >-
curl -fs -o/dev/null -w %{redirect_url} $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/$VER_TAG
&& echo "HAS_RELEASE=1" >> $GITHUB_ENV
|| echo "HAS_RELEASE=0" >> $GITHUB_ENV
- name: Build binary and installer
if: ${{ env.HAS_RELEASE == '0' }}
working-directory: build
run: make REPOSITORY=${AWS_OKTA_REPOSITORY} VERSION=${VER_TAG} WIXIMG=${WIXIMG} installer
- name: Create a Release
if: ${{ env.HAS_RELEASE == '0' }}
uses: softprops/action-gh-release@v1
with:
name: aws-okta ${{ env.VER_TAG }}
tag_name: ${{ env.VER_TAG }}
files: |
installer/src/bin/*.exe
installer/out/*.msi
body: |
Windows amd64 release of `aws-okta` via `${{ env.VER_TAG }}`
${{ env.AWS_OKTA_REPOSITORY }}/tree/${{ env.VER_TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}