-
Notifications
You must be signed in to change notification settings - Fork 59
142 lines (142 loc) · 5.6 KB
/
build.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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: build
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
workflow_dispatch:
inputs:
create_release:
type: boolean
description: "Create GitHub release for current version"
required: false
default: false
jobs:
build_lantern:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubicloud-standard-4-arm, macos-13]
postgres: [12, 13, 14, 15, 16, 17]
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Build
id: build
run: sudo sh -c "PG_VERSION=$PG_VERSION USE_SOURCE=1 GITHUB_OUTPUT=$GITHUB_OUTPUT BUILD_PACKAGES=1 USE_SSL=1 ./ci/scripts/build.sh"
env:
PG_VERSION: ${{ matrix.postgres }}
- name: Create Archive Package
id: archive
run: sudo sh -c "GITHUB_OUTPUT=$GITHUB_OUTPUT ./ci/scripts/package-archive.sh"
- name: Upload deb package artifacts
uses: actions/upload-artifact@v4
if: ${{ steps.build.outputs.deb_package_path != '' && github.event_name == 'workflow_dispatch' && inputs.create_release }}
with:
name: ${{ steps.build.outputs.deb_package_name }}
path: ${{ steps.build.outputs.deb_package_path }}
- name: Upload archive package artifacts
uses: actions/upload-artifact@v4
if: ${{ steps.archive.outputs.archive_package_path != '' && github.event_name == 'workflow_dispatch' && inputs.create_release }}
with:
name: ${{ steps.archive.outputs.archive_package_name }}
path: ${{ steps.archive.outputs.archive_package_path }}
build_extras:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubicloud-standard-4-arm, macos-13]
postgres: [12, 13, 14, 15, 16, 17]
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Build
id: build
run: sudo sh -c "PG_VERSION=$PG_VERSION SETUP_ENV=1 USE_SOURCE=1 SETUP_POSTGRES=1 PACKAGE_EXTENSION=1 GITHUB_OUTPUT=$GITHUB_OUTPUT ./ci/scripts/build-extras.sh"
env:
PG_VERSION: ${{ matrix.postgres }}
- name: Build Lantern CLI
id: build_cli
run: sudo sh -c "PACKAGE_CLI=1 GITHUB_OUTPUT=$GITHUB_OUTPUT ./ci/scripts/build-extras.sh"
if: ${{ matrix.postgres == 17 }} # run only once
- name: Upload archive package artifacts
if: ${{ github.event_name == 'workflow_dispatch' && inputs.create_release }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.archive_package_name }}
path: ${{ steps.build.outputs.archive_package_path }}
- name: Upload Lantern CLI artifacts
if: ${{ matrix.postgres == 17 && github.event_name == 'workflow_dispatch' && inputs.create_release }} # run only once
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build_cli.outputs.cli_package_name }}
path: ${{ steps.build_cli.outputs.cli_package_path }}
package:
runs-on: ubuntu-22.04
needs: [build_lantern, build_extras]
if: ${{ github.event_name == 'workflow_dispatch' && inputs.create_release }}
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- uses: actions/download-artifact@v4
with:
pattern: lantern-extras-*.tar
merge-multiple: true
path: /tmp/lantern-extras-package
- uses: actions/download-artifact@v4
with:
pattern: lantern-cli-*
merge-multiple: true
path: /tmp/lantern-cli-package
- uses: actions/download-artifact@v4
with:
pattern: lantern-*.tar
merge-multiple: true
path: /tmp/lantern-package
- name: Create universal package
id: package
run: sudo sh -c "GITHUB_OUTPUT=$GITHUB_OUTPUT PACKAGE_EXTRAS=1 GITHUB_TOKEN=$GITHUB_TOKEN ./ci/scripts/universal-package.sh"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.package.outputs.package_name }}
path: ${{ steps.package.outputs.package_path }}
- name: Create source code archive with submodules
run: |
find ./ -name '.git*' -exec rm -r {} \; || true
tar -czf /tmp/lantern-v${{ steps.package.outputs.package_version }}-source.tar.gz .
- name: Create GitHub release
uses: softprops/action-gh-release@v2
id: create_release
with:
name: Lantern v${{ steps.package.outputs.package_version }}
tag_name: v${{ steps.package.outputs.package_version }}
files: |
${{ steps.package.outputs.package_path }}
/tmp/lantern-v${{ steps.package.outputs.package_version }}-source.tar.gz
/tmp/lantern-cli-package/*
generate_release_notes: true
- name: Homebrew release
uses: var77/bump-homebrew-formula-action@main
with:
formula-name: lantern
formula-path: Formula/lantern.rb
tag-name: v${{ steps.package.outputs.package_version }}
download-url: https://github.com/lanterndata/lantern/releases/download/v${{ steps.package.outputs.package_version }}/lantern-v${{ steps.package.outputs.package_version }}-source.tar.gz
homebrew-tap: lanterndata/homebrew-lantern
commit-message: |
{{formulaName}} {{version}}
base-branch: main
env:
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_COMMITTER_TOKEN }}