-
-
Notifications
You must be signed in to change notification settings - Fork 11
147 lines (128 loc) · 4.85 KB
/
test_and_deploy.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
# Useful Links
# Python with Github Actions: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Test and Deploy
# Run this workflow on every push or pull request
on:
push:
pull_request:
# workflow_dispatch:
# inputs:
# tag_name:
# description: 'Tag name for release'
# required: true
# Uncomment to run this workflow only when a tag is pushed
# Can set custom wildcards instead of '*', like 'v*' for tags starting with v
# NOTE: Releases are only published on tags, see "Release" step below
#on:
# push:
# tags:
# - '*'
# Docs on sharing data between jobs (between VMs): https://help.github.com/en/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts#passing-data-between-jobs-in-a-workflow
jobs:
# Windows Build
windows_build:
name: Windows Build
runs-on: windows-latest
strategy:
matrix:
python-version: [3.8]
steps:
# Download the repository
- uses: actions/checkout@v3
# Setup python (Windows VM is Python 3.7 by default, we need at least Python 3.8)
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Configure Rust for 32-bit builds
# Please use fixed versions of rust so that installs build consistently
# (So they don't randomly trigger Windows Defender)
- name: Install and configure rust for 32-bit builds
uses: actions-rs/toolchain@v1
with:
toolchain: 1.66.0
target: i686-pc-windows-msvc
default: true
# Caching for Rust
- name: Cache rust builds
uses: Swatinem/rust-cache@v2
with:
workspaces: install_loader
# Run Python Deploy Script
# This also installs and scans .exe with virustotal on Windows (to try prevent .exe virus false positives)
- name: Run Deploy Script
run: python travis_build_script.py
# Run virus scan (only on tagged builds)
- name: Run VirusTotal Scan
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' # only scan when releasing
env:
VT_API_KEY: ${{ secrets.VT_API_KEY }}
run: |
pip install vt-py
python virusTotalScan.py
# Upload Artifact
- name: Upload Windows Build
uses: actions/upload-artifact@v2
with:
name: windows-loader-exe
path: travis_installer_output/*.*
if-no-files-found: error
# Linux/Mac Build
linux_mac_build:
name: Linux and Mac Build
needs: windows_build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
# Download the repository
- uses: actions/checkout@v3
# Setup Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Run JSON Validation script
- name: Validate JSON
run: bash travis_validate_json.sh
# Download Windows artifacts
- name: Download all Windows .exe artifacts
uses: actions/download-artifact@v3
with:
name: windows-loader-exe
path: travis_installer_output
# Run Python Deploy Script
- name: Run Deploy Script
run: python travis_build_script.py
# Publish a release (tagged commits)
# For more info on options see: https://github.com/softprops/action-gh-release
- name: Release (tag)
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') # only publish tagged commits
with:
files: |
travis_installer_output/*.tar.gz
travis_installer_output/*.exe
travis_installer_output/*.zip
body_path: github_actions_changelog_template_generated.md
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The next step allows to manually publish a release via the GitHub web UI,
# without having to clone the repo and push a new tag.
- name: Release (manual)
uses: softprops/action-gh-release@v1
if: github.event_name == 'workflow_dispatch'
with:
files: |
travis_installer_output/07th-Mod.Installer.mac.zip
travis_installer_output/07th-Mod.Installer.linux.tar.gz
travis_installer_output/07th-Mod.Installer.Windows.exe
travis_installer_output/07th-Mod.Installer.Windows.NoAdmin.exe
travis_installer_output/07th-Mod.Installer.Windows.SafeMode.exe
body_path: github_actions_changelog_template_generated.md
draft: true
tag_name: ${{ github.event.inputs.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}