Skip to content

Commit

Permalink
Added: CICD to automatically build/export binaries. (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
stmSi authored Mar 3, 2023
1 parent 9cdace4 commit 627a819
Show file tree
Hide file tree
Showing 8 changed files with 592 additions and 3 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Check Releases"
on:
schedule:
- cron: '27 23 * * *'
push:
branches:
- master
jobs:
fetch:
name: Fetch Latest Godot Engine Release
runs-on: ubuntu-20.04
outputs:
release_tag: ${{ steps.parse.outputs.tag }}
steps:
- id: parse
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG=$(gh release view --repo godotengine/godot --json tagName --jq .tagName)
echo "tag=$TAG" >> $GITHUB_OUTPUT
current:
name: Fetch Current Godot CI release
runs-on: ubuntu-20.04
outputs:
release_tag: ${{ steps.parse.outputs.tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: parse
run: echo "tag=$(git tag --list --sort=-creatordate | head --lines 1)" >> $GITHUB_OUTPUT
create:
needs: [fetch, current]
name: Create New Godot CI Release
runs-on: ubuntu-20.04
if: needs.fetch.outputs.release_tag != needs.current.outputs.release_tag
steps:
- uses: actions/checkout@v3
- run: gh release view --repo godotengine/godot --json body --jq .body | sed 's/\\r\\n/\n/g' > body.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
git config user.name github-actions
git config user.email [email protected]
git tag ${{ needs.fetch.outputs.release_tag }}
git push
- uses: softprops/[email protected]
with:
body_path: body.txt
tag_name: ${{ needs.fetch.outputs.release_tag }}
token: ${{ secrets.PAT }}
118 changes: 118 additions & 0 deletions .github/workflows/godot-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: "godot-ci export"
on: push

env:
GODOT_VERSION: "4.0"
EXPORT_NAME: ultimate-myanmar-typing-wizard
PROJECT_PATH: ./

jobs:
export-windows:
name: Windows Export
runs-on: ubuntu-20.04
container:
image: 09799474633/mm-typing-game-godot
steps:
- name: Checkout
uses: actions/checkout@v2
with:
lfs: true
- name: Setup
run: |
mkdir -v -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
cp -rvf /templates/${GODOT_VERSION}.stable/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable/
- name: Windows Build
run: |
mkdir -v -p build/windows
cp -rvf Texts build/windows/
godot --headless --export-debug "Windows Desktop"
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: ultimate-myanmar-typing-wizard_windows_debug_x64_64.zip
path: build/windows

export-linux:
name: Linux Export
runs-on: ubuntu-20.04
container:
image: 09799474633/mm-typing-game-godot
steps:
- name: Checkout
uses: actions/checkout@v2
with:
lfs: true
- name: Setup
run: |
mkdir -v -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
cp -rvf /templates/${GODOT_VERSION}.stable/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable/
- name: Linux Build
run: |
mkdir -v -p build/linux
cp -rvf Texts build/linux/
godot --headless --export-debug "Linux/X11"
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: ultimate-myanmar-typing-wizard_linux_debug_x86_x64.zip
path: build/linux

# export-web:
# name: Web Export
# runs-on: ubuntu-20.04
# container:
# image: barichello/godot-ci:3.3.4
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# with:
# lfs: true
# - name: Setup
# run: |
# mkdir -v -p ~/.local/share/godot/templates
# mv /templates/${GODOT_VERSION}.stable ~/.local/share/godot/templates/${GODOT_VERSION}.stable
# - name: Web Build
# run: |
# mkdir -v -p build/web
# cd $PROJECT_PATH
# godot -v --export "HTML5" ../build/web/index.html
# - name: Upload Artifact
# uses: actions/upload-artifact@v1
# with:
# name: web
# path: build/web
# - name: Install rsync 📚
# run: |
# apt-get update && apt-get install -y rsync
# - name: Deploy to GitHub Pages 🚀
# uses: JamesIves/github-pages-deploy-action@releases/v4
# with:
# branch: gh-pages # The branch the action should deploy to.
# folder: build/web # The folder the action should deploy.

# export-mac:
# name: Mac Export
# runs-on: ubuntu-20.04
# container:
# image: barichello/godot-ci:3.3.4
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# with:
# lfs: true
# - name: Setup
# run: |
# mkdir -v -p ~/.local/share/godot/templates
# mv /templates/${GODOT_VERSION}.stable ~/.local/share/godot/templates/${GODOT_VERSION}.stable
# - name: Mac Build
# run: |
# mkdir -v -p build/mac
# cd $PROJECT_PATH
# godot -v --export "Mac OSX" ../build/mac/$EXPORT_NAME.zip
# - name: Upload Artifact
# uses: actions/upload-artifact@v1
# with:
# name: mac
# path: build/mac
79 changes: 79 additions & 0 deletions .github/workflows/manual_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Manual Build
on:
workflow_dispatch:
inputs:
version:
description: 'Version of engine to build e.g. "3.4.4", "3.5"'
required: true
type: string
release_name:
description: 'Release name, usually "stable", but can also be something like "rc3", "beta1"'
type: string
default: "stable"
required: true
env:
IMAGE_NAME: godot-ci
jobs:
build:
name: Build Image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: echo IMAGE_TAG=$(echo ${{ github.event.inputs.release_name != 'stable' && format('.{0}', github.event.inputs.release_name) || '' }}) >> $GITHUB_ENV
- name: Build and push Docker images
uses: docker/[email protected]
with:
context: .
file: Dockerfile
push: true
tags: |
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
build-args: |
GODOT_VERSION=${{ github.event.inputs.version }}
RELEASE_NAME=${{ github.event.inputs.release_name }}
SUBDIR=${{ github.event.inputs.release_name != 'stable' && format('/{0}', github.event.inputs.release_name) || '' }}
build-mono:
name: Build Mono Image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: echo IMAGE_TAG=$(echo ${{ github.event.inputs.release_name != 'stable' && format('.{0}', github.event.inputs.release_name) || '' }}) >> $GITHUB_ENV
- name: Build and push Docker images
uses: docker/[email protected]
with:
context: .
file: mono.Dockerfile
push: true
tags: |
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:mono-${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:mono-${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
build-args: |
GODOT_VERSION=${{ github.event.inputs.version }}
RELEASE_NAME=${{ github.event.inputs.release_name }}
SUBDIR=${{ github.event.inputs.release_name != 'stable' && format('/{0}', github.event.inputs.release_name) || '' }}
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Release
on:
release:
types: [released]
env:
IMAGE_NAME: godot-ci
jobs:
version:
name: Get Version
runs-on: ubuntu-20.04
outputs:
version: ${{ steps.calculate.outputs.version }}
release_name: ${{ steps.calculate.outputs.release_name }}
steps:
- id: calculate
run: |
REF_NAME=${{ github.ref_name }}
echo "version=${REF_NAME%-*}" >> $GITHUB_OUTPUT
echo "release_name=${REF_NAME#*-}" >> $GITHUB_OUTPUT
build:
name: Build Image
runs-on: ubuntu-20.04
needs: [version]
steps:
- uses: actions/checkout@v3
- run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/[email protected]
with:
context: .
file: Dockerfile
push: true
tags: |
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ needs.version.outputs.version }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:latest
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ needs.version.outputs.version }}
build-args: |
GODOT_VERSION=${{ needs.version.outputs.version }}
RELEASE_NAME=${{ needs.version.outputs.release_name }}
build-mono:
name: Build Mono Image
runs-on: ubuntu-20.04
needs: [version]
steps:
- uses: actions/checkout@v3
- run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/[email protected]
with:
context: .
file: mono.Dockerfile
push: true
tags: |
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:mono-${{ needs.version.outputs.version }}
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:mono-latest
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:mono-latest
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:mono-${{ needs.version.outputs.version }}
build-args: |
GODOT_VERSION=${{ needs.version.outputs.version }}
RELEASE_NAME=${{ needs.version.outputs.release_name }}
Loading

0 comments on commit 627a819

Please sign in to comment.