forked from hashicorp/waypoint
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (118 loc) · 4.05 KB
/
build-waypoint-oss.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
117
118
119
120
121
---
name: build_waypoint
on:
workflow_call:
inputs:
bundle-path:
required: false
type: string
cgo-enabled:
type: string
default: 0
create-packages:
type: boolean
default: true
goos:
required: true
type: string
goarch:
required: true
type: string
go-tags:
type: string
go-version:
type: string
package-name:
type: string
required: true
waypoint-version:
type: string
required: true
waypoint-base-version:
type: string
required: true
waypoint-prerelease:
type: string
required: true
jobs:
build:
runs-on: ubuntu-latest
outputs:
bin-name: ${{ steps.get-bin-name.outputs.bin-name }}
name: Build ${{ inputs.package-name }} ${{ inputs.goos }} ${{ inputs.goarch }} v${{ inputs.waypoint-version }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Restore ui assets
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ui/dist/assets
key: ui_assets_${{ github.sha }}
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Restore build assets
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: internal/assets
key: build_assets_${{ github.sha }}
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Determine binary name
id: get-bin-name
run: |
bin_name="${{ inputs.package-name }}"
if [ "${{ inputs.goos }}" == "windows" ];then
bin_name="${bin_name}.exe"
fi
echo "bin-name=${bin_name}" | tee -a "${GITHUB_OUTPUT}"
- name: Build binary
env:
GOOS: ${{ inputs.goos }}
GOARCH: ${{ inputs.goarch }}
WAYPOINT_GOOS: ${{ inputs.goos }}
WAYPOINT_GOARCH: ${{ inputs.goarch }}
BASE_VERSION: ${{ inputs.waypoint-base-version }}
PRERELEASE: ${{ inputs.waypoint-prerelease }}
CGO_ENABLED: ${{ inputs.cgo-enabled }}
CRT_BIN_NAME: ${{ steps.get-bin-name.outputs.bin-name }}
uses: hashicorp/[email protected]
with:
product_name: ${{ inputs.package-name }}
product_version: ${{ inputs.waypoint-version }}
go_version: ${{ inputs.go-version }}
os: ${{ inputs.goos }}
arch: ${{ inputs.goarch }}
reproducible: nope
instructions: |
make bin/crt-${{ inputs.package-name }}
- name: Linux packaging
id: packaging
if: ${{ (inputs.goos == 'linux') && (inputs.package-name == 'waypoint') && (inputs.goarch != '386') }}
uses: hashicorp/actions-packaging-linux@v1
with:
name: ${{ inputs.package-name }}
description: ${{ inputs.package-name }}
arch: ${{ inputs.goarch }}
version: ${{ inputs.waypoint-version }}
maintainer: "HashiCorp"
homepage: "https://github.com/hashicorp/waypoint"
license: "MPL-2.0"
binary: "dist/${{ inputs.package-name }}"
deb_depends: "git"
rpm_depends: "git"
- name: Set Package Names
if: steps.packaging.conclusion == 'success'
run: |
echo "RPM_PACKAGE=$(basename out/*.rpm)" >> "$GITHUB_ENV"
echo "DEB_PACKAGE=$(basename out/*.deb)" >> "$GITHUB_ENV"
- name: Upload rpm package
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: steps.packaging.conclusion == 'success'
with:
name: ${{ env.RPM_PACKAGE }}
path: out/${{ env.RPM_PACKAGE }}
- name: Upload deb package
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: steps.packaging.conclusion == 'success'
with:
name: ${{ env.DEB_PACKAGE }}
path: out/${{ env.DEB_PACKAGE }}