Просмотр исходного кода

build docker image with matrix strategy

Yuki Takei 3 лет назад
Родитель
Сommit
5d33a13653
2 измененных файлов с 20 добавлено и 7 удалено
  1. 10 6
      .github/workflows/release-rc.yml
  2. 10 1
      .github/workflows/release.yml

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

@@ -11,6 +11,10 @@ jobs:
 
     runs-on: ubuntu-latest
 
+    strategy:
+      matrix:
+        platform: [linux/amd64, linux/arm64]
+
     steps:
     - uses: actions/checkout@v3
       with:
@@ -24,15 +28,14 @@ jobs:
       id: meta
       uses: docker/metadata-action@v4
       with:
-        # images: weseek/growi,ghcr.io/weseek/growi
-        images: ghcr.io/weseek/growi
+        images: weseek/growi,ghcr.io/weseek/growi
         tags: |
           type=raw,value=${{ steps.package-json.outputs.packageVersion }}
           type=raw,value=${{ steps.package-json.outputs.packageVersion }}.{{sha}}
 
-    # - name: Login to docker.io registry
-    #   run: |
-    #     echo ${{ secrets. DOCKER_REGISTRY_PASSWORD }} | docker login --username wsmoogle --password-stdin
+    - name: Login to docker.io registry
+      run: |
+        echo ${{ secrets. DOCKER_REGISTRY_PASSWORD }} | docker login --username wsmoogle --password-stdin
 
     - name: Login to GitHub Container Registry
       uses: docker/login-action@v2
@@ -42,6 +45,7 @@ jobs:
         password: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
 
     - name: Set up QEMU
+      if: ${{ matrix.platform == 'linux/arm64' }}
       uses: docker/setup-qemu-action@v1
 
     - name: Set up Docker Buildx
@@ -52,7 +56,7 @@ jobs:
       with:
         context: .
         file: ./packages/app/docker/Dockerfile
-        platforms: linux/amd64,linux/arm64
+        platforms: ${{ matrix.platform }}
         push: true
         builder: ${{ steps.buildx.outputs.name }}
         cache-from: type=gha

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

@@ -126,6 +126,10 @@ jobs:
 
     runs-on: ubuntu-latest
 
+    strategy:
+      matrix:
+        platform: [linux/amd64, linux/arm64]
+
     steps:
     - uses: actions/checkout@v3
       with:
@@ -156,6 +160,10 @@ jobs:
         username: wsmoogle
         password: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
 
+    - name: Set up QEMU
+      if: ${{ matrix.platform == 'linux/arm64' }}
+      uses: docker/setup-qemu-action@v1
+
     - name: Set up Docker Buildx
       uses: docker/setup-buildx-action@v2
 
@@ -164,7 +172,7 @@ jobs:
       with:
         context: .
         file: ./packages/app/docker/Dockerfile
-        platforms: linux/amd64
+        platforms: ${{ matrix.platform }}
         push: true
         builder: ${{ steps.buildx.outputs.name }}
         cache-from: type=gha
@@ -185,6 +193,7 @@ jobs:
         channel: '#release'
         url: ${{ secrets.SLACK_WEBHOOK_URL }}
         created_tag: 'v${{ needs.create-github-release.outputs.RELEASED_VERSION }}'
+        message: '*Release v${{ needs.create-github-release.outputs.RELEASED_VERSION }} (${{ matrix.platform }})* Succeeded'
 
     - name: Check whether workspace is clean
       run: |