ScreenTranslator/.github/workflows/build.yml

101 lines
2.8 KiB
YAML
Raw Normal View History

2020-05-02 23:20:45 +07:00
name: App build
2020-03-01 16:30:43 +07:00
on: [push]
jobs:
release:
name: Create release
if: contains(github.ref, '/tags/')
2022-01-12 23:04:20 +07:00
runs-on: ubuntu-18.04
2020-03-01 16:30:43 +07:00
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Store release url
run: echo "${{ steps.create_release.outputs.upload_url }}" > ./release_upload_url
- name: Upload release url
uses: actions/upload-artifact@v1
with:
path: ./release_upload_url
name: release_upload_url
build:
name: Build ${{ matrix.config.name }}${{ matrix.config.tag }}
2020-03-01 16:30:43 +07:00
runs-on: ${{ matrix.config.os }}
env:
OS: ${{ matrix.config.name }}
2022-03-28 01:44:01 +07:00
MSVC_VERSION: 2022/Enterprise
2020-03-01 16:30:43 +07:00
strategy:
matrix:
config:
- { name: "win64", os: windows-latest }
- { name: "win32", os: windows-latest }
2022-01-12 23:04:20 +07:00
- { name: "linux", os: ubuntu-18.04 }
2020-03-05 01:19:40 +07:00
# - { name: "macos", os: macos-latest }
2020-03-01 16:30:43 +07:00
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Setup python
uses: actions/setup-python@v1
with:
python-version: "3.x"
- name: Install system libs
if: runner.os == 'Linux'
2020-03-04 01:05:44 +07:00
run: |
2020-07-15 03:19:59 +07:00
sudo apt-get install libgl1-mesa-dev libxkbcommon-x11-0 libxcb-*
2020-12-10 02:47:35 +07:00
echo "QMAKE_FLAGS=QMAKE_CXX=g++-9 QMAKE_CC=gcc-9" >> $GITHUB_ENV
2020-03-01 16:30:43 +07:00
2020-03-09 16:10:41 +07:00
- name: Cache dependencies
2022-02-06 01:20:54 +07:00
uses: actions/cache@v2
2020-03-09 16:10:41 +07:00
with:
path: deps
2022-02-06 01:20:54 +07:00
key: ${{ env.OS }}-${{ hashFiles('./share/ci/*.py') }}
2020-03-09 16:10:41 +07:00
2022-02-06 00:32:16 +07:00
- name: Make a release
2020-03-01 16:30:43 +07:00
shell: bash
run: |
2022-02-06 00:32:16 +07:00
python ./share/ci/release.py
echo "artifact=`python ./share/ci/release.py artifact_name`" >> $GITHUB_ENV
2020-03-01 16:30:43 +07:00
- name: Upload build artifact
if: env.artifact != ''
uses: actions/upload-artifact@v1
with:
name: ${{ env.artifact }}
path: ./${{ env.artifact }}
- name: Download release url
if: contains(github.ref, '/tags/')
uses: actions/download-artifact@v1
with:
name: release_upload_url
path: ./
- name: Set release env
if: contains(github.ref, '/tags/')
shell: bash
2020-12-10 02:47:35 +07:00
run: echo "upload_url=`cat ./release_upload_url`" >> $GITHUB_ENV
2020-03-01 16:30:43 +07:00
- name: Upload release artifacts
if: contains(github.ref, '/tags/')
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.upload_url }}
asset_path: ./${{ env.artifact }}
asset_name: ${{ env.artifact }}
asset_content_type: application/zip