Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate image release process #79

Merged
merged 5 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Check Releases"
on:
schedule:
- cron: '27 23 * * *'

jobs:
fetch:
name: Fetch Latest Godot Engine Release
runs-on: ubuntu-latest
outputs:
release_tag: ${{ steps.parse.outputs.tag }}
json: ${{ steps.get_latest_release.outputs.data }}
steps:
- uses: octokit/[email protected]
id: get_latest_release
with:
route: GET /repos/godotengine/godot/releases/latest
owner: octokit
repo: request-action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: parse
run: |
TAG=$(echo '${{ steps.get_latest_release.outputs.data }}' | jq --raw-output .tag_name)
echo "::set-output name=tag::$TAG"
current:
name: Fetch Current Godot CI release
runs-on: ubuntu-latest
outputs:
release_tag: ${{ steps.parse.outputs.tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: parse
run: echo "::set-output name=tag::$(git tag --list --sort=-creatordate | head --lines 1)"
create:
needs: [fetch, current]
name: Create New Godot CI Release
runs-on: ubuntu-latest
if: needs.fetch.outputs.release_tag != needs.current.outputs.release_tag
steps:
- uses: actions/checkout@v3
- run: echo '${{ needs.fetch.outputs.json }}' | jq --raw-output .body | sed 's/\\r\\n/\n/g' > body.txt
- 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 }}
3 changes: 3 additions & 0 deletions .github/workflows/godot-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ jobs:
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:
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Release
on:
release:
types: [released]
env:
IMAGE_NAME: godot-ci
jobs:
version:
name: Get Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.calculate.outputs.version }}
release_name: ${{ steps.calculate.outputs.release_name }}
steps:
- id: calculate
run: |
REF_NAME=${{ github.ref_name }}
echo "::set-output name=version::${REF_NAME%-*}"
echo "::set-output name=release_name::${REF_NAME#*-}"
build:
name: Build Image
runs-on: ubuntu-latest
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 }}
build-mono:
name: Build Mono Image
runs-on: ubuntu-latest
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 }}

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
ENV GODOT_VERSION "3.4.2"
ARG GODOT_VERSION="3.4.2"

RUN wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip \
&& wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/Godot_v${GODOT_VERSION}-stable_export_templates.tpz \
Expand Down
4 changes: 2 additions & 2 deletions mono.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

# When in doubt see the downloads page
# https://downloads.tuxfamily.org/godotengine/
ENV GODOT_VERSION "3.4.2"
ARG GODOT_VERSION="3.4.2"

# Example values: stable, beta3, rc1, alpha2, etc.
# Also change the SUBDIR property when NOT using stable
ENV RELEASE_NAME "stable"
ARG RELEASE_NAME="stable"

# This is only needed for non-stable builds (alpha, beta, RC)
# e.g. SUBDIR "/beta3"
Expand Down