Automate image release process (#79)
This commit is contained in:
83
.github/workflows/release.yml
vendored
Normal file
83
.github/workflows/release.yml
vendored
Normal file
@@ -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/login-action@v1.14.1
|
||||
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/build-push-action@v2.9.0
|
||||
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/login-action@v1.14.1
|
||||
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/build-push-action@v2.9.0
|
||||
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 }}
|
||||
|
||||
Reference in New Issue
Block a user