88 lines
2.6 KiB
YAML
88 lines
2.6 KiB
YAML
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
|
|
name: Build MOTG Cross-Platform
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
|
|
permissions:
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
runs-on: ${{matrix.os}}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set up Python 3.10
|
|
uses: actions/setup-python@v3
|
|
with:
|
|
python-version: "3.10"
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install -U pyinstaller
|
|
- name: Build with PyInstaller
|
|
run: |
|
|
pyinstaller -D -F -n generate -c -n MOTD-${{matrix.os}} ./generate.py
|
|
- name: Create Release
|
|
uses: actions/github-script@v2
|
|
with:
|
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
script: |
|
|
console.log('environment', process.versions)
|
|
const fs = require('fs').promises;
|
|
|
|
const { repo: { owner, repo }, sha } = context;
|
|
console.log({ owner, repo, sha });
|
|
|
|
const release = await github.repos.createRelease({
|
|
owner, repo,
|
|
tag_name: process.env.GITHUB_REF,
|
|
prerelease: true,
|
|
target_commitish: sha
|
|
});
|
|
|
|
console.log('created release', { release });
|
|
|
|
for (let file of await fs.readdir('./dist')) {
|
|
console.log('uploading', `./dist/${file}`);
|
|
|
|
await github.repos.uploadReleaseAsset({
|
|
owner, repo,
|
|
release_id: release.data.id,
|
|
name: file,
|
|
data: await fs.readFile(`./dist/${file}`)
|
|
});
|
|
}
|
|
|
|
# - name: Create Release
|
|
# id: create_release
|
|
# uses: actions/create-release@v1
|
|
# env:
|
|
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
# with:
|
|
# tag_name: ${{github.ref}}
|
|
# release_name: Dev Release ${{github.ref}}
|
|
# prerelease: true
|
|
# - name: Upload Release Artifact
|
|
# id: upload-release-asset
|
|
# uses: actions/upload-release-asset@v1
|
|
# env:
|
|
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
# with:
|
|
# upload_url: ${{steps.create_release.outputs.upload_url}}
|
|
# asset_path: ./dist/MOTD-${{matrix.os}}.exe
|
|
# asset_name: MOTD ${{ matrix.os }}
|
|
# asset_content_type: a[[;ocatopm
|
|
|