fix ci #8
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: GLSMAC autobuild | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
# branches: [ "stable" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
# branches: [ "stable" ] | ||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
ver: ${{ steps.env.env.ver }} | ||
sha: ${{ steps.env.env.sha }} | ||
env: | ||
ver: v0.3 | ||
steps: | ||
- uses: benjlevesque/[email protected] | ||
id: short-sha | ||
with: | ||
length: 7 | ||
# - uses: dev-drprasad/[email protected] | ||
# with: | ||
# keep_latest: 4 | ||
# delete_tags: true | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- info: | ||
env: | ||
sha: ${{ steps.short-sha.outputs.sha }} | ||
run: echo $sha $ver | ||
- name: create-release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.ver }}-${{ env.sha }} | ||
release_name: ${{ env.ver }}-${{ env.sha }} | ||
draft: false | ||
prerelease: false | ||
build_linux64: | ||
needs: [prepare] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: install_dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libfreetype-dev libsdl2-dev libsdl2-image-dev libglu-dev libglew-dev libossp-uuid-dev libyaml-cpp-dev | ||
- name: prepare | ||
run: | | ||
mkdir build | ||
- name: cmake | ||
working-directory: ./build | ||
run: cmake -DCMAKE_BUILD_TYPE=Portable64 .. | ||
- name: make | ||
working-directory: ./build | ||
run: make | ||
- name: data | ||
working-directory: ./build | ||
run: mv ../GLSMAC_data bin/ | ||
- name: pack | ||
working-directory: ./build | ||
run: tar -C bin -zcvf GLSMAC.tar.gz GLSMAC GLSMAC_data | ||
- name: publish | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: GLSMAC-linux64-bin | ||
path: | | ||
./build/GLSMAC.tar.gz | ||
- name: upload | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.prepare.outputs.upload_url }} | ||
asset_path: ./build/GLSMAC.tar.gz | ||
asset_name: GLSMAC-${{ needs.prepare.ver }}-linux64-${{ needs.prepare.sha }}.tar.gz | ||
asset_content_type: application/gzip | ||
build_windows: | ||
needs: [prepare] | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: install_dependencies | ||
run: | | ||
choco install ninja | ||
- name: prepare | ||
run: | | ||
mkdir build | ||
- name: cmake | ||
working-directory: ./build | ||
run: cmake -G Ninja -DCMAKE_BUILD_TYPE=Portable64 -DVENDORED_DEPENDENCIES=1 .. | ||
- name: make | ||
working-directory: ./build | ||
run: ninja | ||
- name: data | ||
working-directory: ./build | ||
run: mv ../GLSMAC_data bin/ | ||
- name: pack | ||
working-directory: ./build | ||
run: tar -C bin -zcvf GLSMAC.tar.gz GLSMAC.exe GLSMAC_data | ||
- name: publish | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: GLSMAC-windows64-bin | ||
path: | | ||
./build/GLSMAC.tar.gz | ||
- name: upload | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.prepare.outputs.upload_url }} | ||
asset_path: ./build/GLSMAC.tar.gz | ||
asset_name: GLSMAC-${{ needs.prepare.outputs.ver }}-windows64-${{ needs.prepare.outputs.sha }}.tar.gz | ||
asset_content_type: application/gzip |