-
Notifications
You must be signed in to change notification settings - Fork 1
160 lines (147 loc) · 4.79 KB
/
release.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
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
name: Release From Branch
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
on:
workflow_dispatch:
inputs:
release_branch:
description: "Staging branch to run release from"
jobs:
smoke-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.release_branch }}
- uses: ./.github/actions/setup-node
with:
enable-corepack: false
- uses: ./.github/actions/setup-go
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Test
run: pnpm -- titan run test --filter=cli --color
darwin:
name: "Build Darwin Binares"
needs: [smoke-test]
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.release_branch }}
- run: git fetch origin --tags
- uses: ./.github/actions/setup-node
with:
enable-corepack: false
- uses: ./.github/actions/setup-go
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser-pro
version: latest
install-only: true
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Build Artifacts
run: cd cli && make publish-titan-darwin
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: titan-artifacts-darwin
path: cli/dist-darwin
# compiles linux and windows in a container
cross:
name: "Build Linux and Windows Binaries"
needs: [smoke-test]
runs-on: ubuntu-latest
container:
image: docker://ghcr.io/khulnasoft/titan-cross:v1.18.5
steps:
- uses: actions/checkout@v3
with:
ref: "${{ inputs.release_branch }}"
- run: git fetch origin --tags
- uses: ./.github/actions/setup-node
with:
enable-corepack: false
- uses: ./.github/actions/setup-go
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser-pro
version: latest
install-only: true
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Build Artifacts
run: cd cli && make publish-titan-cross
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: titan-artifacts-cross
path: cli/dist-cross
final-publish:
needs: [cross, darwin]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: "${{ inputs.release_branch }}"
- run: git fetch origin --tags
- uses: ./.github/actions/setup-node
with:
enable-corepack: false
- uses: ./.github/actions/setup-go
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Configure git
run: |
git config --global user.name 'Turbobot'
git config --global user.email '[email protected]'
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser-pro
version: latest
install-only: true
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
# Download the prebuilt binaries for each platform,
# combine them into a single dist-combined folder,
# then delegate to goreleaser / Makefile for deploy.
# Finally, set up a PR for the branch we released off of
- name: Download Cross-compiled Artifacts
uses: actions/download-artifact@v3
with:
name: titan-artifacts-cross
path: cli/dist-cross
- name: Download Darwin Artifacts
uses: actions/download-artifact@v3
with:
name: titan-artifacts-darwin
path: cli/dist-darwin
- name: Combine Artifacts
run: cd cli && mkdir -p dist-combined && cp -a dist-cross/. dist-combined/ && cp -a dist-darwin/. dist-combined/
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Release
run: cd cli && make publish
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- uses: repo-sync/pull-request@v2
with:
source_branch: ${{ inputs.release_branch }}
destination_branch: main
pr_title: Merge release branch ${{ inputs.release_branch }}
pr_body: ":crown: Merge release branch back to main"
pr_reviewer: ${{ github.actor }},gsoltis
pr_allow_empty: true
github_token: ${{ secrets.TITANBOT }}