-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (141 loc) · 4.77 KB
/
build.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
name: Build Chat2Cmd Executable
on:
workflow_dispatch:
inputs:
build_id:
required: true
type: string
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.ACTION_SECRET }}
with:
tag_name: ${{ github.event.inputs.build_id }}
release_name: Release ${{ github.event.inputs.build_id }}
body: |
Release version on ${{ github.event.inputs.build_id }}.
- name: Write upload Url
run: echo "${{ steps.create_release.outputs.upload_url }}" > my-data.txt
- name: Upload data as artifact
uses: actions/upload-artifact@v2
with:
name: my-artifact
path: my-data.txt
build-on-macos:
runs-on: macos-latest
needs: create-release
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11.0'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build macOS executable
run: |
pyinstaller --onefile --distpath ./dist/macos chat2cmd/chat2cmd.py
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: my-artifact
- name: Read file content as variable
id: read_file
run: echo "CONTENT=$(cat my-data.txt)" >> $GITHUB_ENV
- name: print content
id: print
run: echo "content:${{ env.CONTENT }}"
- name: Upload macOS executable
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.ACTION_SECRET }}
with:
#upload_url: ${{ needs.create-release.outputs.upload_url }}
upload_url: ${{ env.CONTENT }}
asset_path: ./dist/macos/chat2cmd
asset_name: chat2cmd-macos-${{ github.event.inputs.build_id }}
asset_content_type: application/octet-stream
build-on-linux:
runs-on: ubuntu-latest
needs: create-release
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11.0'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build Linux executable
run: |
pyinstaller --onefile --distpath ./dist/linux chat2cmd/chat2cmd.py
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: my-artifact
- name: Read file content as variable
id: read_file
run: echo "CONTENT=$(cat my-data.txt)" >> $GITHUB_ENV
- name: print content
id: print
run: echo "content:${{ env.CONTENT }}"
- name: Upload Linux executable
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.ACTION_SECRET }}
with:
#upload_url: ${{ needs.create-release.outputs.upload_url }}
upload_url: ${{ env.CONTENT }}
asset_path: ./dist/linux/chat2cmd
asset_name: chat2cmd-linux-${{ github.event.inputs.build_id }}
asset_content_type: application/octet-stream
build-on-windows:
runs-on: windows-latest
needs: create-release
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11.0'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build Windows executable
run: |
pyinstaller --onefile --distpath ./dist/windows chat2cmd/chat2cmd.py
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: my-artifact
- name: Load environment variables from file
shell: bash
run: echo "CONTENT=$(cat my-data.txt)" >> $GITHUB_ENV
- name: Upload Windows executable
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.ACTION_SECRET }}
with:
#upload_url: ${{ needs.create-release.outputs.upload_url }}
upload_url: ${{ env.CONTENT }}
asset_path: ./dist/windows/chat2cmd.exe
asset_name: chat2cmd-windows-${{ github.event.inputs.build_id }}.exe
asset_content_type: application/octet-stream