Skip to content

Update and optimize headers #751

Update and optimize headers

Update and optimize headers #751

# 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 }}