cfdsa #100
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: Deploy Knotris | |
on: [push] | |
env: | |
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
IS_MASTER: ${{contains(github.ref, 'master')}} | |
DISCORD_WEBHOOK: ${{secrets.DISCORD_WEBHOOK}} | |
jobs: | |
BuildAndPublish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Knotris Source Code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Download + Authorize Godot | |
run: | | |
curl -L -o godot.zip https://downloads.tuxfamily.org/godotengine/3.2.3/Godot_v3.2.3-stable_linux_headless.64.zip | |
unzip godot.zip | |
mv Godot_v3.2.3-stable_linux_headless.64 godot | |
ls | |
chmod +x godot | |
- name: Download Export Templates | |
run: | | |
curl -L -o export_templates.zip https://downloads.tuxfamily.org/godotengine/3.2.3/Godot_v3.2.3-stable_export_templates.tpz | |
unzip export_templates.zip | |
- name: Install Export Templates | |
run: | | |
mkdir -p ~/.local/share/godot/templates/3.2.3.stable | |
mv ./templates/* ~/.local/share/godot/templates/3.2.3.stable | |
- name: Make Exports Folder | |
run: | | |
mkdir exports | |
- name: Export Windows Port | |
run: | | |
mkdir ./exports/windows | |
./godot --path ./project.godot --export "KnotrisDesktop" ./exports/windows/Knotris.exe | |
- name: Export Mac Port | |
run: | | |
mkdir ./exports/mac | |
./godot --path ./project.godot --export "KnotrisMac" ./exports/mac/Knotris.zip | |
- name: Export Linux Port | |
run: | | |
mkdir ./exports/linux | |
./godot --path ./project.godot --export "KnotrisLinux" ./exports/linux/Knotris.x86_64 | |
- name: Export Web Port | |
run: | | |
mkdir ./exports/web | |
./godot --path ./project.godot --export "KnotrisHTML5" ./exports/web/index.html | |
- name: Export Web iOS Port | |
run: | | |
mkdir ./exports/web-ios | |
./godot --path ./project.godot --export "KnotrisHTML5iOS" ./exports/web-ios/index.html | |
- name: Publish Export Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: exports | |
path: exports | |
ReleaseGithubPages: | |
needs: BuildAndPublish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Knotris Source Code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set Git User | |
run: | | |
git config --global user.email "knotris@github.com" | |
git config --global user.name "KnotrisAction" | |
- name: Checkout gh-pages Branch | |
run: | | |
git checkout gh-pages | |
- name: Get Latest Code in Master | |
run: | | |
git add . | |
git pull origin master | |
- name: Remove .gitignore | |
run: rm .gitignore | |
- name: Download Exports | |
uses: actions/download-artifact@v2 | |
with: | |
name: exports | |
path: exports | |
- name: Make Folders | |
run: | | |
mkdir -p ./docs/web | |
mkdir -p ./docs/web/iOS | |
- name: Move Web Exports | |
run: | | |
mv ./exports/web/* ./docs/web/ | |
mv ./exports/web-ios/* ./docs/web/iOS/ | |
- name: Commit Web Export | |
run: | | |
git add ./docs/* | |
git commit -m "Deploy most recent release!" | |
- name: Push Most Recent Release | |
if: ${{ contains(github.ref, 'master') && success() }} | |
run: | | |
git push | |
CreateNewGithubRelease: | |
needs: BuildAndPublish | |
if: ${{ contains(github.ref, 'master') }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Knotris Source Code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Download Exports | |
uses: actions/download-artifact@v2 | |
with: | |
name: exports | |
path: exports | |
- name: Zip Exports | |
run: zip -r exports.zip exports | |
- name: Create New Release | |
uses: actions/create-release@v1 | |
id: create_release | |
with: | |
tag_name: ${{ github.run_number }} | |
release_name: Release ${{ github.run_number }} | |
body: | |
draft: false | |
prerelease: false | |
- name: Upload Exports | |
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: ./exports.zip | |
asset_name: exports.zip | |
asset_content_type: application/zip | |
PushExportsToItch: | |
needs: BuildAndPublish | |
if: ${{ contains(github.ref, 'master') }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Exports | |
uses: actions/download-artifact@v2 | |
with: | |
name: exports | |
path: exports | |
- name: Download + Authorize Butler | |
run: | | |
curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default | |
unzip butler.zip | |
chmod +x butler | |
./butler -V | |
- name: Login To Butler | |
run: ./butler login | |
- name: Push Windows Export To Itch | |
run: ./butler push ./exports/windows/Knotris.exe izook/knotris:win | |
- name: Push Mac Export To Itch | |
run: ./butler push ./exports/mac/Knotris.zip izook/knotris:mac | |
- name: Push Linux Export To Itch | |
run: ./butler push ./exports/linux/Knotris.x86_64 izook/knotris:linux | |
- name: Compress Web Export | |
run: zip web.zip ./exports/web/* -j | |
- name: Push Web Export To Itch | |
run: ./butler push ./web.zip izook/knotris:web | |
AlertPipelineResult: | |
needs: [BuildAndPublish, ReleaseGithubPages, PushExportsToItch] | |
if: ${{ always() }} | |
env: | |
DID_PREV_JOBS_SUCCEED: ${{ contains(needs.BuildAndPublish.result, 'success' ) && contains(needs.ReleaseGithubPages.result, 'success' ) && contains(needs.PushExportsToItch.result, 'success' ) }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send Discord Success Message | |
if: ${{ contains(github.ref, 'master') && env.DID_PREV_JOBS_SUCCEED == 'true' }} | |
run: | | |
curl --location --request POST $DISCORD_WEBHOOK \ | |
--header 'Content-Type: application/json' \ | |
--data-raw '{"content": "Knotris has successfully released and deployed!"}' | |
- name: Send Discord Failure Message | |
if: ${{ contains(github.ref, 'master') && env.DID_PREV_JOBS_SUCCEED != 'true' }} | |
run: | | |
curl --location --request POST $DISCORD_WEBHOOK \ | |
--header 'Content-Type: application/json' \ | |
--data-raw '{"content": "Knotris release and/or deployment has failed!"}' |