-
Notifications
You must be signed in to change notification settings - Fork 9
92 lines (87 loc) · 2.7 KB
/
ci.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
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
tags: ['v**']
jobs:
test_and_lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
node-version: 18.x
cache: 'npm'
- run: npm ci
- run: npm run lint
package:
name: Package binaries
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Generate binaries for macOS, Linux and Windows
run: npm run package
- name: Rename macOS binary to conform to GitHub CLI extension rules
run: mv bin/migrate-project-macos bin/gh-migrate-project-darwin-amd64
- name: Rename Windows binary to conform to GitHub CLI extension rules
run: mv bin/migrate-project-win.exe bin/gh-migrate-project-windows-amd64.exe
- name: Rename Linux binary to conform to GitHub CLI extension rules
run: mv bin/migrate-project-linux bin/gh-migrate-project-linux-amd64
- name: Upload macOS binary as artifact
uses: actions/upload-artifact@v3
with:
name: package-macos
path: bin/gh-migrate-project-darwin-amd64
- name: Upload Linux binary as artifact
uses: actions/upload-artifact@v3
with:
name: package-linux
path: bin/gh-migrate-project-linux-amd64
- name: Upload Windows binary as artifact
uses: actions/upload-artifact@v3
with:
name: package-windows
path: bin/gh-migrate-project-windows-amd64.exe
create_release:
name: Create release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: ['package', 'test_and_lint']
permissions:
contents: write
steps:
- name: Download Windows binary
uses: actions/download-artifact@v3
with:
name: package-windows
path: bin
- name: Download macOS binary
uses: actions/download-artifact@v3
with:
name: package-macos
path: bin
- name: Download Linux binary
uses: actions/download-artifact@v3
with:
name: package-linux
path: bin
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
files: |
bin/gh-migrate-project-darwin-amd64
bin/gh-migrate-project-linux-amd64
bin/gh-migrate-project-windows-amd64.exe
generate_release_notes: true