Skip to content

Commit 627a819

Browse files
authored
Added: CICD to automatically build/export binaries. (#1)
1 parent 9cdace4 commit 627a819

8 files changed

+592
-3
lines changed

.github/workflows/check-release.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "Check Releases"
2+
on:
3+
schedule:
4+
- cron: '27 23 * * *'
5+
push:
6+
branches:
7+
- master
8+
jobs:
9+
fetch:
10+
name: Fetch Latest Godot Engine Release
11+
runs-on: ubuntu-20.04
12+
outputs:
13+
release_tag: ${{ steps.parse.outputs.tag }}
14+
steps:
15+
- id: parse
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
run: |
19+
TAG=$(gh release view --repo godotengine/godot --json tagName --jq .tagName)
20+
echo "tag=$TAG" >> $GITHUB_OUTPUT
21+
current:
22+
name: Fetch Current Godot CI release
23+
runs-on: ubuntu-20.04
24+
outputs:
25+
release_tag: ${{ steps.parse.outputs.tag }}
26+
steps:
27+
- uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 0
30+
- id: parse
31+
run: echo "tag=$(git tag --list --sort=-creatordate | head --lines 1)" >> $GITHUB_OUTPUT
32+
create:
33+
needs: [fetch, current]
34+
name: Create New Godot CI Release
35+
runs-on: ubuntu-20.04
36+
if: needs.fetch.outputs.release_tag != needs.current.outputs.release_tag
37+
steps:
38+
- uses: actions/checkout@v3
39+
- run: gh release view --repo godotengine/godot --json body --jq .body | sed 's/\\r\\n/\n/g' > body.txt
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
- run: |
43+
git config user.name github-actions
44+
git config user.email [email protected]
45+
git tag ${{ needs.fetch.outputs.release_tag }}
46+
git push
47+
- uses: softprops/[email protected]
48+
with:
49+
body_path: body.txt
50+
tag_name: ${{ needs.fetch.outputs.release_tag }}
51+
token: ${{ secrets.PAT }}

.github/workflows/godot-ci.yml

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: "godot-ci export"
2+
on: push
3+
4+
env:
5+
GODOT_VERSION: "4.0"
6+
EXPORT_NAME: ultimate-myanmar-typing-wizard
7+
PROJECT_PATH: ./
8+
9+
jobs:
10+
export-windows:
11+
name: Windows Export
12+
runs-on: ubuntu-20.04
13+
container:
14+
image: 09799474633/mm-typing-game-godot
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
lfs: true
20+
- name: Setup
21+
run: |
22+
mkdir -v -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
23+
cp -rvf /templates/${GODOT_VERSION}.stable/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable/
24+
- name: Windows Build
25+
run: |
26+
mkdir -v -p build/windows
27+
cp -rvf Texts build/windows/
28+
godot --headless --export-debug "Windows Desktop"
29+
30+
- name: Upload Artifact
31+
uses: actions/upload-artifact@v1
32+
with:
33+
name: ultimate-myanmar-typing-wizard_windows_debug_x64_64.zip
34+
path: build/windows
35+
36+
export-linux:
37+
name: Linux Export
38+
runs-on: ubuntu-20.04
39+
container:
40+
image: 09799474633/mm-typing-game-godot
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v2
44+
with:
45+
lfs: true
46+
- name: Setup
47+
run: |
48+
mkdir -v -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
49+
cp -rvf /templates/${GODOT_VERSION}.stable/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable/
50+
- name: Linux Build
51+
run: |
52+
mkdir -v -p build/linux
53+
cp -rvf Texts build/linux/
54+
godot --headless --export-debug "Linux/X11"
55+
56+
- name: Upload Artifact
57+
uses: actions/upload-artifact@v1
58+
with:
59+
name: ultimate-myanmar-typing-wizard_linux_debug_x86_x64.zip
60+
path: build/linux
61+
62+
# export-web:
63+
# name: Web Export
64+
# runs-on: ubuntu-20.04
65+
# container:
66+
# image: barichello/godot-ci:3.3.4
67+
# steps:
68+
# - name: Checkout
69+
# uses: actions/checkout@v2
70+
# with:
71+
# lfs: true
72+
# - name: Setup
73+
# run: |
74+
# mkdir -v -p ~/.local/share/godot/templates
75+
# mv /templates/${GODOT_VERSION}.stable ~/.local/share/godot/templates/${GODOT_VERSION}.stable
76+
# - name: Web Build
77+
# run: |
78+
# mkdir -v -p build/web
79+
# cd $PROJECT_PATH
80+
# godot -v --export "HTML5" ../build/web/index.html
81+
# - name: Upload Artifact
82+
# uses: actions/upload-artifact@v1
83+
# with:
84+
# name: web
85+
# path: build/web
86+
# - name: Install rsync 📚
87+
# run: |
88+
# apt-get update && apt-get install -y rsync
89+
# - name: Deploy to GitHub Pages 🚀
90+
# uses: JamesIves/github-pages-deploy-action@releases/v4
91+
# with:
92+
# branch: gh-pages # The branch the action should deploy to.
93+
# folder: build/web # The folder the action should deploy.
94+
95+
# export-mac:
96+
# name: Mac Export
97+
# runs-on: ubuntu-20.04
98+
# container:
99+
# image: barichello/godot-ci:3.3.4
100+
# steps:
101+
# - name: Checkout
102+
# uses: actions/checkout@v2
103+
# with:
104+
# lfs: true
105+
# - name: Setup
106+
# run: |
107+
# mkdir -v -p ~/.local/share/godot/templates
108+
# mv /templates/${GODOT_VERSION}.stable ~/.local/share/godot/templates/${GODOT_VERSION}.stable
109+
# - name: Mac Build
110+
# run: |
111+
# mkdir -v -p build/mac
112+
# cd $PROJECT_PATH
113+
# godot -v --export "Mac OSX" ../build/mac/$EXPORT_NAME.zip
114+
# - name: Upload Artifact
115+
# uses: actions/upload-artifact@v1
116+
# with:
117+
# name: mac
118+
# path: build/mac

.github/workflows/manual_build.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Manual Build
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'Version of engine to build e.g. "3.4.4", "3.5"'
7+
required: true
8+
type: string
9+
release_name:
10+
description: 'Release name, usually "stable", but can also be something like "rc3", "beta1"'
11+
type: string
12+
default: "stable"
13+
required: true
14+
env:
15+
IMAGE_NAME: godot-ci
16+
jobs:
17+
build:
18+
name: Build Image
19+
runs-on: ubuntu-20.04
20+
steps:
21+
- uses: actions/checkout@v3
22+
- run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
23+
- name: Login to GitHub Container Registry
24+
uses: docker/[email protected]
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.repository_owner }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
- name: Login to DockerHub
30+
uses: docker/login-action@v1
31+
with:
32+
username: ${{ secrets.DOCKERHUB_USERNAME }}
33+
password: ${{ secrets.DOCKERHUB_TOKEN }}
34+
- run: echo IMAGE_TAG=$(echo ${{ github.event.inputs.release_name != 'stable' && format('.{0}', github.event.inputs.release_name) || '' }}) >> $GITHUB_ENV
35+
- name: Build and push Docker images
36+
uses: docker/[email protected]
37+
with:
38+
context: .
39+
file: Dockerfile
40+
push: true
41+
tags: |
42+
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
43+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
44+
build-args: |
45+
GODOT_VERSION=${{ github.event.inputs.version }}
46+
RELEASE_NAME=${{ github.event.inputs.release_name }}
47+
SUBDIR=${{ github.event.inputs.release_name != 'stable' && format('/{0}', github.event.inputs.release_name) || '' }}
48+
build-mono:
49+
name: Build Mono Image
50+
runs-on: ubuntu-20.04
51+
steps:
52+
- uses: actions/checkout@v3
53+
- run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
54+
- name: Login to GitHub Container Registry
55+
uses: docker/[email protected]
56+
with:
57+
registry: ghcr.io
58+
username: ${{ github.repository_owner }}
59+
password: ${{ secrets.GITHUB_TOKEN }}
60+
- name: Login to DockerHub
61+
uses: docker/login-action@v1
62+
with:
63+
username: ${{ secrets.DOCKERHUB_USERNAME }}
64+
password: ${{ secrets.DOCKERHUB_TOKEN }}
65+
- run: echo IMAGE_TAG=$(echo ${{ github.event.inputs.release_name != 'stable' && format('.{0}', github.event.inputs.release_name) || '' }}) >> $GITHUB_ENV
66+
- name: Build and push Docker images
67+
uses: docker/[email protected]
68+
with:
69+
context: .
70+
file: mono.Dockerfile
71+
push: true
72+
tags: |
73+
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:mono-${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
74+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:mono-${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
75+
build-args: |
76+
GODOT_VERSION=${{ github.event.inputs.version }}
77+
RELEASE_NAME=${{ github.event.inputs.release_name }}
78+
SUBDIR=${{ github.event.inputs.release_name != 'stable' && format('/{0}', github.event.inputs.release_name) || '' }}
79+

.github/workflows/release.yml

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [released]
5+
env:
6+
IMAGE_NAME: godot-ci
7+
jobs:
8+
version:
9+
name: Get Version
10+
runs-on: ubuntu-20.04
11+
outputs:
12+
version: ${{ steps.calculate.outputs.version }}
13+
release_name: ${{ steps.calculate.outputs.release_name }}
14+
steps:
15+
- id: calculate
16+
run: |
17+
REF_NAME=${{ github.ref_name }}
18+
echo "version=${REF_NAME%-*}" >> $GITHUB_OUTPUT
19+
echo "release_name=${REF_NAME#*-}" >> $GITHUB_OUTPUT
20+
build:
21+
name: Build Image
22+
runs-on: ubuntu-20.04
23+
needs: [version]
24+
steps:
25+
- uses: actions/checkout@v3
26+
- run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
27+
- name: Login to GitHub Container Registry
28+
uses: docker/[email protected]
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.repository_owner }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
- name: Login to DockerHub
34+
uses: docker/login-action@v1
35+
with:
36+
username: ${{ secrets.DOCKERHUB_USERNAME }}
37+
password: ${{ secrets.DOCKERHUB_TOKEN }}
38+
- name: Build and push Docker images
39+
uses: docker/[email protected]
40+
with:
41+
context: .
42+
file: Dockerfile
43+
push: true
44+
tags: |
45+
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ needs.version.outputs.version }}
46+
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:latest
47+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
48+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ needs.version.outputs.version }}
49+
build-args: |
50+
GODOT_VERSION=${{ needs.version.outputs.version }}
51+
RELEASE_NAME=${{ needs.version.outputs.release_name }}
52+
build-mono:
53+
name: Build Mono Image
54+
runs-on: ubuntu-20.04
55+
needs: [version]
56+
steps:
57+
- uses: actions/checkout@v3
58+
- run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
59+
- name: Login to GitHub Container Registry
60+
uses: docker/[email protected]
61+
with:
62+
registry: ghcr.io
63+
username: ${{ github.repository_owner }}
64+
password: ${{ secrets.GITHUB_TOKEN }}
65+
- name: Login to DockerHub
66+
uses: docker/login-action@v1
67+
with:
68+
username: ${{ secrets.DOCKERHUB_USERNAME }}
69+
password: ${{ secrets.DOCKERHUB_TOKEN }}
70+
- name: Build and push Docker images
71+
uses: docker/[email protected]
72+
with:
73+
context: .
74+
file: mono.Dockerfile
75+
push: true
76+
tags: |
77+
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:mono-${{ needs.version.outputs.version }}
78+
ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:mono-latest
79+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:mono-latest
80+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:mono-${{ needs.version.outputs.version }}
81+
build-args: |
82+
GODOT_VERSION=${{ needs.version.outputs.version }}
83+
RELEASE_NAME=${{ needs.version.outputs.release_name }}
84+

0 commit comments

Comments
 (0)