Update main.yml #12
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
# https://medium.com/@TomRvr/continuous-integration-for-a-qt-project-with-github-b19a33b39980 | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
- 'continuous-integration' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- 'main' | |
- 'continuous-integration' | |
defaults: | |
run: | |
shell: cmd | |
env: | |
SOURCE_DIR: ${{ github.workspace }} | |
QT_VERSION: 5.9.9 | |
ARTIFACT: build-assets | |
name: Create Release | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-2019 | |
steps: | |
- name: (1) Checkout repo | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
# - name: (2) Get all tags for correct version determination | |
# working-directory: ${{ github.workspace }} | |
# run: | | |
# git fetch --all --tags -f | |
- name: (3) Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ env.QT_VERSION }} | |
host: windows | |
target: desktop | |
arch: win64_msvc2017_64 | |
dir: ${{ runner.temp }} | |
# modules: qtcharts qt3d | |
setup-python: false | |
- name: (4) Download JOM | |
uses: suisei-cn/actions-download-file@v1 | |
with: | |
url: http://download.qt.io/official_releases/jom/jom.zip | |
target: ${{ runner.temp }}\ | |
- name: (5) Unzip JOM | |
working-directory: ${{ runner.temp }} | |
run: | | |
7z x jom.zip -ojom | |
- name: (6) Create build directory | |
run: mkdir ${{ env.SOURCE_DIR }}\build\nifskope_converter | |
- name: (7) Set up Visual Studio shell | |
uses: egor-tensin/vs-shell@v2 | |
with: | |
arch: x64 | |
- name: (8) Build NifSkope | |
working-directory: ${{ env.SOURCE_DIR }}\build\nifskope_converter | |
run: | | |
qmake -r ${{ env.SOURCE_DIR }}\src\models-and-animations\nifskope_converter\NifSkope.pro | |
${{ runner.temp }}\jom\jom -j2 | |
cd release | |
windeployqt --qmldir ${{ env.SOURCE_DIR }} NifSkope.exe --pdb --release --compiler-runtime | |
copy C:\Windows\System32\concrt140.dll . | |
copy C:\Windows\System32\vccorlib140.dll . | |
copy C:\Windows\System32\msvcp140.dll . | |
copy C:\Windows\System32\vcruntime140.dll . | |
# - name: (9) Build others | |
- name: (10) Zip build | |
working-directory: ${{ env.SOURCE_DIR }} | |
run: | | |
7z a nifskope-build.zip ${{ env.SOURCE_DIR }}\build\nifskope_converter\release\* -r | |
- name: (11) Save build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.ARTIFACT }} | |
path: | | |
${{ env.SOURCE_DIR }}\build\nifskope_converter\release\ | |
${{ env.SOURCE_DIR }}\src\models-and-animations\elric\ | |
${{ env.SOURCE_DIR }}\src\convert.ps1 | |
${{ env.SOURCE_DIR }}\convert.bat | |
${{ env.SOURCE_DIR }}\README.md | |
${{ env.SOURCE_DIR }}\images\ | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download Artifacts | |
id: download | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.ARTIFACT }} | |
path: ${{ runner.temp }}/artifacts | |
- name: Zip Folder | |
shell: bash | |
working-directory: ${{ steps.download.outputs.download-path }} | |
run: | | |
mkdir ${{ runner.temp }}/assets | |
zip -r ${{ runner.temp }}/assets/${{ env.ARTIFACT }}.zip . | |
# - name: Conventional Changelog Action | |
# uses: TriPSs/conventional-changelog-action@v3 | |
# with: | |
# github-token: ${{ secrets.github_token }} | |
- name: Create Release | |
id: create-release | |
uses: actions/create-release@v1 | |
# if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
with: | |
# tag_name: ${{ steps.changelog.outputs.tag }} | |
# release_name: ${{ steps.changelog.outputs.tag }} | |
# body: ${{ steps.changelog.outputs.clean_changelog }} | |
tag_name: ${{ github.run_number }} | |
release_name: ${{ github.run_number }} | |
draft: false | |
prerelease: true | |
- name: 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: ${{ runner.temp }}/assets/${{ env.ARTIFACT }}.zip | |
asset_name: v${{ github.run_number }}.zip | |
asset_content_type: application/zip |