-
Notifications
You must be signed in to change notification settings - Fork 3
176 lines (153 loc) · 5.35 KB
/
publish.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Publish
on:
release:
types:
- created
jobs:
upload_to_pypi:
runs-on: ubuntu-latest
steps:
# Check out the repo and set up python
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # cache dependencies
- run: pip install -r requirements.txt
# Ensure we have setuptools, wheel, and twine installed
- run: pip install setuptools, wheel, twine
# Build the wheel
- name: Build the wheel
run: python setup.py sdist bdist_wheel
# Publish
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*
build_editor:
name: Build ${{ matrix.config.prefix }}
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {
os: ubuntu-20.04,
exe: "foundry-smb3",
prefix: "linux",
suffix: "",
architecture: "x64",
}
- {
os: windows-2019,
exe: "foundry-smb3.exe",
prefix: "win64",
suffix: ".exe",
architecture: "x64",
}
- {
os: macos-latest,
exe: "foundry-smb3",
prefix: "osx",
suffix: "",
architecture: "x64",
}
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.11"
architecture: ${{ matrix.config.architecture }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
# Install Dependencies
- name: Install Dependencies
run: pip install -r requirements.txt
# Install Pyinstaller
- name: Install Pyinstaller
run: pip install pyinstaller
- name: Build Executable
run: |
pyinstaller foundry-smb3.spec
mv dist/${{ matrix.config.exe }} dist/${{ matrix.config.prefix }}-foundry-smb3${{ matrix.config.suffix }}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.config.prefix }}-foundry-smb3${{ matrix.config.suffix }}
path: dist/${{ matrix.config.prefix }}-foundry-smb3${{ matrix.config.suffix }}
build_manual:
name: Build Manual
runs-on: ubuntu-20.04
steps:
- name: Check out
uses: actions/checkout@v2
- name: Setup node/npm
uses: actions/setup-node@v2
- name: Get Dependencies
run: |
npm install markdown-pdf
wget https://github.com/sindresorhus/github-markdown-css/blob/gh-pages/github-markdown.css
- name: Build PDF
run: node_modules/.bin/markdown-pdf --css-path github-markdwon.css MANUAL.md
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: MANUAL.pdf
path: MANUAL.pdf
# We're forced to create a separate publish job since the create-release
# action fails if it is run twice on the same tag. But we have multiple
# build systems (Windows, Linux, OSX) and only want one release.
publish:
needs: [build_editor, build_manual]
name: "Publish"
runs-on: ubuntu-latest # this doesn't matter as it's only codestyle and artifact collection
steps:
- name: Check out
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Download All Artifacts
uses: actions/download-artifact@v2
with:
path: ./artifacts/
# upload-release-asset doesn't accept a directory or an array
# of files, so we must individually upload each one
- name: Upload SMB3 Foundry Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "artifacts/linux-foundry-smb3/linux-foundry-smb3"
asset_name: "linux-foundry-smb3"
asset_content_type: application/octet-stream
- name: Upload SMB3 Foundry OSX
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "artifacts/osx-foundry-smb3/osx-foundry-smb3"
asset_name: "osx-foundry-smb3"
asset_content_type: application/octet-stream
- name: Upload SMB3 Foundry Windows x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "artifacts/win64-foundry-smb3.exe/win64-foundry-smb3.exe"
asset_name: "win64-foundry-smb3.exe"
asset_content_type: application/octet-stream
- name: Upload SMB3 Foundry Manual
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "artifacts/MANUAL.pdf/MANUAL.pdf"
asset_name: "MANUAL.pdf"
asset_content_type: application/pdf