-
Notifications
You must be signed in to change notification settings - Fork 1
177 lines (168 loc) · 5.76 KB
/
test.yml
File metadata and controls
177 lines (168 loc) · 5.76 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Test and Release
on:
pull_request:
branches:
- 'main'
push:
branches:
- 'main'
tags:
- 'v*'
- '!vlatest'
workflow_dispatch:
inputs:
target:
description: 'Target platform'
required: true
default: 'x86_64-apple-darwin'
type: choice
options:
- 'x86_64-apple-darwin'
- 'x86_64-unknown-linux-gnu'
- 'x86_64-unknown-linux-musl'
- 'x86_64-unknown-netbsd'
- 'x86_64-unknown-freebsd'
- 'x86_64-pc-windows-msvc'
- 'x86_64-pc-windows-gnu'
- 'aarch64-apple-darwin'
- 'aarch64-unknown-linux-musl'
- 'aarch64-unknown-linux-gnu'
- 'aarch64-unknown-freebsd'
- 'aarch64-pc-windows-msvc'
slim:
description: 'Enable slim mode'
required: true
default: false
type: boolean
use-cross:
description: 'Enable cross-compilation'
required: true
default: false
type: boolean
version:
description: 'The version of the pact cli to release as'
default: 'latest'
force_release:
description: 'force release for target from branch other than main'
required: true
default: false
type: boolean
os:
description: 'Operating system'
required: true
default: 'macos-14'
type: choice
options: ['ubuntu-latest', 'macos-12', 'macos-14', 'windows-latest']
jobs:
version:
name: "🧮 Compute the version"
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_next_version.outputs.version }}
hasNextVersion: ${{ steps.get_next_version.outputs.hasNextVersion }}
steps:
- uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: Get next version
id: get_next_version
uses: thenativeweb/get-next-version@main
- name: print
run: |
echo "version: ${{ steps.get_next_version.outputs.version }}"
echo "has_next_version: ${{ steps.get_next_version.outputs.hasNextVersion }}"
changelog:
needs:
- version
name: ✍️ Generate changelog
runs-on: ubuntu-latest
outputs:
content: ${{steps.git-cliff.outputs.content}}
release_body: ${{ steps.git-cliff-changes.outputs.content }}
steps:
- uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: --verbose
env:
OUTPUT: CHANGELOG.md
- name: Print the changelog
run: echo "${{ steps.git-cliff.outputs.content }}"
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff-changes
with:
config: cliff.toml
args: -vv --latest --strip header
env:
OUTPUT: CHANGES.md
- name: Print the changelog
run: echo "${{ steps.git-cliff-changes.outputs.content }}"
build-single:
needs: [version, changelog]
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: ./.github/workflows/reusable-build.yml
with:
target: ${{ github.event.inputs.target }}
os: ${{ github.event.inputs.os }}
use-cross: ${{ github.event.inputs.use-cross == 'true'}}
slim: ${{ github.event.inputs.slim == 'true' }}
version: ${{ needs.version.outputs.version }}
name: '🛠️ Build binaries'
permissions:
contents: write
build:
needs: [version, changelog]
if: ${{ github.event_name != 'workflow_dispatch' }}
name: '🛠️ Build binaries'
uses: ./.github/workflows/reusable-build.yml
with:
target: ${{ matrix.job.target }}
os: ${{ matrix.job.os }}
use-cross: ${{ matrix.job.use-cross }}
slim: false
version: ${{ needs.version.outputs.version }}
strategy:
fail-fast: false
matrix:
job:
- { target: x86_64-apple-darwin, os: macos-14, use-cross: false }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, use-cross: true }
- { target: x86_64-unknown-linux-musl, os: ubuntu-latest, use-cross: true }
- { target: x86_64-unknown-netbsd, os: ubuntu-latest, use-cross: true }
- { target: x86_64-unknown-freebsd, os: ubuntu-latest, use-cross: true }
- { target: x86_64-pc-windows-msvc, os: windows-latest, use-cross: false }
- { target: x86_64-pc-windows-gnu, os: windows-latest, use-cross: false }
- { target: aarch64-apple-darwin, os: macos-14, use-cross: false }
- { target: aarch64-unknown-linux-musl, os: ubuntu-latest, use-cross: true }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-latest, use-cross: true }
- { target: aarch64-unknown-freebsd, os: ubuntu-latest, use-cross: true }
- { target: aarch64-pc-windows-msvc, os: windows-latest, use-cross: false }
release:
needs: ["build", changelog, version ]
name: '📦 Github release'
if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' }}
permissions:
contents: write
uses: ./.github/workflows/reusable-release.yml
with:
version: ${{ needs.version.outputs.version }}
release_notes: ${{ needs.changelog.outputs.release_body }}
release-single:
needs: ["build-single", changelog, version]
name: '📦 Github release - single'
if: ${{ inputs.force_release == true }}
permissions:
contents: write
uses: ./.github/workflows/reusable-release.yml
with:
version: ${{ needs.version.outputs.version }}
release_notes: ${{ needs.changelog.outputs.release_body }}
force_release: ${{ github.event.inputs.force_release == 'true' }}