A community-maintained Python framework for creating mathematical animations.
CI: add a workflow to publish docker image after release (#2701)
Naveen M Kc106b91c93dd
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.ymlnew file mode 100644index 000000000..0eef3cfbf--- /dev/null+++ b/.github/workflows/publish.yml@@ -0,0 +1,117 @@+name: Publish Docker Image++on:+ push:+ branches:+ - main+ release:+ types: [released]++jobs:+ docker-arm64:+ runs-on: [self-hosted, linux, ARM64, docker-installed]+ if: github.event_name != 'release'+ steps:+ - name: Set up Docker Buildx+ uses: docker/setup-buildx-action@v1++ - name: Login to DockerHub+ uses: docker/login-action@v1+ with:+ username: ${{ secrets.DOCKERHUB_USERNAME }}+ password: ${{ secrets.DOCKERHUB_TOKEN }}++ - name: Build and push+ uses: docker/build-push-action@v2+ with:+ push: true+ file: docker/Dockerfile+ tags: |+ manimcommunity/manim:latest++ docker-amd64:+ runs-on: ubuntu-latest+ if: github.event_name != 'release'+ steps:+ - name: Set up Docker Buildx+ uses: docker/setup-buildx-action@v1++ - name: Login to DockerHub+ uses: docker/login-action@v1+ with:+ username: ${{ secrets.DOCKERHUB_USERNAME }}+ password: ${{ secrets.DOCKERHUB_TOKEN }}++ - name: Build and push+ uses: docker/build-push-action@v2+ with:+ push: true+ file: docker/Dockerfile+ tags: |+ manimcommunity/manim:latest++ docker-arm64-release:+ runs-on: [self-hosted, linux, ARM64, docker-installed]+ if: github.event_name == 'release'+ steps:+ - name: Set up Docker Buildx+ uses: docker/setup-buildx-action@v1++ - name: Login to DockerHub+ uses: docker/login-action@v1+ with:+ username: ${{ secrets.DOCKERHUB_USERNAME }}+ password: ${{ secrets.DOCKERHUB_TOKEN }}++ - name: Get Version+ id: create_release+ shell: python+ env:+ tag_act: ${{ github.ref }}+ run: |+ import os+ ref_tag = os.getenv('tag_act').split('/')[-1]+ print(f"::set-output name=tag_name::{ref_tag}")++ - name: Build and push+ uses: docker/build-push-action@v2+ with:+ push: true+ file: docker/Dockerfile+ tags: |+ manimcommunity/manim:stable+ manimcommunity/manim:latest+ manimcommunity/manim:${{ steps.create_release.outputs.tag_name }}++ docker-amd64-release:+ runs-on: ubuntu-latest+ if: github.event_name == 'release'+ steps:+ - name: Set up Docker Buildx+ uses: docker/setup-buildx-action@v1++ - name: Login to DockerHub+ uses: docker/login-action@v1+ with:+ username: ${{ secrets.DOCKERHUB_USERNAME }}+ password: ${{ secrets.DOCKERHUB_TOKEN }}++ - name: Get Version+ id: create_release+ shell: python+ env:+ tag_act: ${{ github.ref }}+ run: |+ import os+ ref_tag = os.getenv('tag_act').split('/')[-1]+ print(f"::set-output name=tag_name::{ref_tag}")++ - name: Build and push+ uses: docker/build-push-action@v2+ with:+ push: true+ file: docker/Dockerfile+ tags: |+ manimcommunity/manim:stable+ manimcommunity/manim:latest+ manimcommunity/manim:${{ steps.create_release.outputs.tag_name }}