changes #68
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push events but only for the dev branch | |
push: | |
branches: [ dev ] | |
# To run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains two jobs called "build" and "commit" | |
build: | |
name: Build Gramup on ${{ matrix.os }} | |
# The types of runners that the job will run on | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out this repository under $GITHUB_WORKSPACE | |
- uses: actions/checkout@v2 | |
# Sets up python 3.10.0 | |
- name: Set up Python 3.10.0 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.10.0 | |
# Setup pip | |
- name: Setup pip | |
run: python -m pip install --upgrade pip | |
# Get the path to cache directory used by pip | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
# This path is specific to Ubuntu | |
path: ${{ steps.pip-cache.outputs.dir }} | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
# Installs dependencies needed for build | |
- name: Install dependencies | |
run: | | |
pip install pyinstaller | |
pip install -r requirements.txt | |
# Builds the app using pyinstaller | |
- name: Build with pyinstaller | |
env: | |
OS_FILENAME: '${{ runner.os }}-app' | |
run: | | |
./build.sh ${OS_FILENAME} | |
touch ${OS_FILENAME}.count | |
shell: bash | |
# Wait for files to be created | |
- name: Wait for files | |
if: runner.os == 'Linux' | |
run: | | |
while [ $(find . -name "*.count" | wc -l) < $OS_COUNT ]; do sleep 1; done | |
env: | |
OS_COUNT: ${{ strategy.job-index }} | |
# Uploads the newly created files for later use | |
- name: Upload Artifacts | |
if: runner.os == 'Linux' | |
uses: actions/upload-artifact@master | |
with: | |
name: created_files | |
path: dist | |
commit: | |
name: Commit created files | |
# Waits for build to complete before proceding. | |
needs: build | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out this repository under $GITHUB_WORKSPACE | |
- uses: actions/checkout@v2 | |
with: | |
ref: "release" | |
# Downloads previously uploaded files | |
- uses: actions/download-artifact@master | |
with: | |
name: created_files | |
path: dist | |
# Configures git | |
- name: Setup Git | |
run: | | |
git config --global user.name 'Rohit T P' | |
git config --global user.email '[email protected]' | |
# Adds the downloaded files to repo | |
- name: Add | |
run: | | |
git add dist/* | |
# Commits and pushes the repo to origin | |
- name: Commit | |
run: | | |
git commit -am "Automated build" | |
git push |