-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate image release process (#79)
- Loading branch information
Showing
5 changed files
with
149 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
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 }} | ||
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-20.04 | ||
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-20.04 | ||
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 }} | ||
token: ${{ secrets.PAT }} |
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
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
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-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 "::set-output name=version::${REF_NAME%-*}" | ||
echo "::set-output name=release_name::${REF_NAME#*-}" | ||
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 }} | ||
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 }} | ||
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
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