Forráskód Böngészése

Merge pull request #348 from PabloCastellano/github-docker-push

Push docker image to Docker Hub
Nathan.fooo 3 éve
szülő
commit
3f90170c71
2 módosított fájl, 45 hozzáadás és 10 törlés
  1. 10 10
      .github/workflows/release.yml
  2. 35 0
      .github/workflows/release_docker.yml

+ 10 - 10
.github/workflows/release.yml

@@ -34,13 +34,13 @@ jobs:
   build-linux-x86:
     runs-on: ubuntu-latest
     needs: create-release
-    env: 
+    env:
       LINUX_APP_RELEASE_PATH: frontend/app_flowy/product/${{ github.ref_name }}/linux/Release
       LINUX_ZIP_NAME: AppFlowy-linux-x86.tar.gz
     steps:
       - name: Checkout
         uses: actions/checkout@v2
-      
+
       - name: Setup environment - Rust and Cargo
         uses: actions-rs/toolchain@v1
         with:
@@ -61,13 +61,13 @@ jobs:
           cargo install --force cargo-make
           cargo install --force duckscript_cli
           cargo make flowy_dev
-      
+
       - name: Build Linux app
         working-directory: frontend
         run: |
           flutter config --enable-linux-desktop
           cargo make --profile production-linux-x86 appflowy
-      
+
       - name: Upload Release Asset
         id: upload-release-asset
         uses: actions/upload-release-asset@v1
@@ -82,7 +82,7 @@ jobs:
   build-macos-x86_64:
     runs-on: macos-latest
     needs: create-release
-    env: 
+    env:
       MACOS_APP_RELEASE_PATH: frontend/app_flowy/product/${{ github.ref_name }}/macos/Release
       MACOS_X86_ZIP_NAME: Appflowy-macos-x86_64.zip
     steps:
@@ -93,7 +93,7 @@ jobs:
         uses: actions-rs/toolchain@v1
         with:
           toolchain: stable
-      
+
       - name: Setup environment - Flutter
         uses: subosito/flutter-action@v2
         with:
@@ -106,17 +106,17 @@ jobs:
           cargo install --force cargo-make
           cargo install --force duckscript_cli
           cargo make flowy_dev
-      
+
       - name: Build macOS app for x86_64
         working-directory: frontend
         run: |
           flutter config --enable-macos-desktop
           cargo make --profile production-mac-x86 appflowy
-      
+
       - name: Archive macOS app
         working-directory: ${{ env.MACOS_APP_RELEASE_PATH }}
         run: zip -qr ${{ env.MACOS_X86_ZIP_NAME }} AppFlowy.app
-      
+
       - name: Upload Release Asset
         uses: actions/upload-release-asset@v1
         env:
@@ -125,4 +125,4 @@ jobs:
           upload_url: ${{ needs.create-release.outputs.upload_url }}
           asset_path: ${{ env.MACOS_APP_RELEASE_PATH }}/${{ env.MACOS_X86_ZIP_NAME }}
           asset_name: ${{ env.MACOS_X86_ZIP_NAME }}
-          asset_content_type: application/octet-stream
+          asset_content_type: application/octet-stream

+ 35 - 0
.github/workflows/release_docker.yml

@@ -0,0 +1,35 @@
+name: release_docker
+
+on:
+  push:
+    branches:
+      - 'main'
+    tags:
+      - '*'
+
+jobs:
+  build-docker-image:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Login to Docker Hub
+        uses: docker/login-action@v1
+        with:
+          username: ${{ secrets.DOCKER_HUB_USERNAME }}
+          password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
+
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v1
+
+      - name: Build and push
+        uses: docker/build-push-action@v2
+        with:
+          context: .
+          file: ./frontend/scripts/docker-buildfiles/Dockerfile
+          builder: ${{ steps.buildx.outputs.name }}
+          push: true
+          tags: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy:${{ github.ref_name }}
+          cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/appflawy:buildcache
+          cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/appflawy:buildcache,mode=max