-
Notifications
You must be signed in to change notification settings - Fork 5
63 lines (60 loc) · 1.76 KB
/
release-please.yaml
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
# SPDX-FileCopyrightText: 2022 - 2024 NRK
#
# SPDX-License-Identifier: MIT
on:
push:
branches:
- main
name: Release
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/[email protected]
id: release-please
with:
config-file: .release-please-config.json
manifest-file: .release-please-manifest.json
outputs:
release_created: ${{ steps.release-please.outputs.release_created }}
tag_name: ${{ steps.release-please.outputs.tag_name }}
build-binaries:
name: Build and push binaries
runs-on: ubuntu-latest
needs: release-please
if: needs.release-please.outputs.release_created
strategy:
matrix:
arch:
- amd64
- arm64
os:
- linux
steps:
-
name: Checkout
uses: actions/[email protected]
with:
ref: ${{ needs.release-please.outputs.tag_name }}
-
name: Setup Go
uses: actions/[email protected]
with:
go-version-file: 'go.mod'
-
name: Build and upload
env:
GH_TOKEN: ${{ github.token }}
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
VERSION: ${{ needs.release-please.outputs.tag_name }}
run: |
LD_FLAGS=""
LD_FLAGS+=" -s" # no debug symbols
LD_FLAGS+=" -w" # no DWARF debug info
LD_FLAGS+=" -X 'main.buildDate=$(date --utc +%Y-%m-%dT%H:%M:%SZ)'"
LD_FLAGS+=" -X 'main.version=${VERSION}'"
ARCHIVE_NAME="terraform-registry_${VERSION}_${GOOS}_${GOARCH}.tar.gz"
make LD_FLAGS="${LD_FLAGS}" build
tar -cvzf "${ARCHIVE_NAME}" terraform-registry
gh release upload ${VERSION} "${ARCHIVE_NAME}"