From 3639390789b44521f869064bbff9ba61e1ff6d6c Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 17:53:34 +0900 Subject: [PATCH 01/14] Add ghcr push (experimental) --- .github/workflows/build.yaml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000000..34fba1e86f --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,33 @@ +name: Build +on: + push: + # タグ付きpushの時にする + tags: + + # TODO: 後で消す + branches: + - migrate/github-actions + + # 手動ビルドもできるように(いる?) + workflow_dispatch: + +jobs: + build: + name: build-images + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: "Login to GitHub Container Registry" + uses: docker/login-aciton@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: "Build and Push" + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: | + ghcr.io/misskeyio/misskey:latest + ghcr.io/misskeyio/misskey:${{ github.ref_name }} From b6af3ab89172371d01330980e9467e970039102b Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 17:56:32 +0900 Subject: [PATCH 02/14] Fix typo :p --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 34fba1e86f..28b13f2bf8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: "Login to GitHub Container Registry" - uses: docker/login-aciton@v2 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} From eb71aa8f8cc7989cdb3787cc66b834a484668b62 Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 18:00:01 +0900 Subject: [PATCH 03/14] Format image tags :thinking_face: --- .github/workflows/build.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 28b13f2bf8..fcd3d2b3ac 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,6 +23,9 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Prepare image tags + run: | + echo "FORMATTED_BRANCH_NAME=$(echo ${{ github.ref_name }} | sed -e 's/\//-/g' )" >> $GITHUB_ENV - name: "Build and Push" uses: docker/build-push-action@v4 with: @@ -30,4 +33,4 @@ jobs: push: true tags: | ghcr.io/misskeyio/misskey:latest - ghcr.io/misskeyio/misskey:${{ github.ref_name }} + ghcr.io/misskeyio/misskey:${FORMATTED_BRANCH_NAME} From 69711f89e694fdd682fc6145dff7c7b65b4417c9 Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 18:01:49 +0900 Subject: [PATCH 04/14] Format image tags (2) :thinking_face: --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fcd3d2b3ac..de73dfa3ee 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -33,4 +33,4 @@ jobs: push: true tags: | ghcr.io/misskeyio/misskey:latest - ghcr.io/misskeyio/misskey:${FORMATTED_BRANCH_NAME} + ghcr.io/misskeyio/misskey:${{ env.FORMATTED_BRANCH_NAME }} From 2331483cd8753adf5524d7622391dfb6158d4a60 Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 18:28:49 +0900 Subject: [PATCH 05/14] Remove build.yaml --- .github/workflows/build.yaml | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index de73dfa3ee..0000000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build -on: - push: - # タグ付きpushの時にする - tags: - - # TODO: 後で消す - branches: - - migrate/github-actions - - # 手動ビルドもできるように(いる?) - workflow_dispatch: - -jobs: - build: - name: build-images - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: "Login to GitHub Container Registry" - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Prepare image tags - run: | - echo "FORMATTED_BRANCH_NAME=$(echo ${{ github.ref_name }} | sed -e 's/\//-/g' )" >> $GITHUB_ENV - - name: "Build and Push" - uses: docker/build-push-action@v4 - with: - context: . - push: true - tags: | - ghcr.io/misskeyio/misskey:latest - ghcr.io/misskeyio/misskey:${{ env.FORMATTED_BRANCH_NAME }} From e2d0fbb85977976ca5f8b85d90174e0b195f11bd Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 18:29:06 +0900 Subject: [PATCH 06/14] Rewrite github actions (from original build workflow) --- .github/workflows/docker-io.yaml | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/docker-io.yaml diff --git a/.github/workflows/docker-io.yaml b/.github/workflows/docker-io.yaml new file mode 100644 index 0000000000..fd18d1f12a --- /dev/null +++ b/.github/workflows/docker-io.yaml @@ -0,0 +1,53 @@ +name: Publish Docker image (io) + +on: + push: + tags: + + # TODO: 後で消す + branches: + - migrate/github-actions + + workflow_dispatch: + +jobs: + push_to_registry: + name: Push Docker image to GitHub Container Registry + runs-on: ubuntu-22.04 + if: github.repository == 'MisskeyIO/misskey' + steps: + - name: Check out the repo + uses: actions/checkout@v3 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2.5.0 + with: + platforms: linux/amd64,linux/arm64 + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/misskeyio/misskey + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Prepare image tags + run: | + echo "FORMATTED_BRANCH_NAME=$(echo ${{ github.ref_name }} | sed -e 's/\//-/g' )" >> $GITHUB_ENV + - name: Build and Push to Docker Hub + uses: docker/build-push-action@v4 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + push: true + platforms: ${{ steps.buildx.outputs.platforms }} + provenance: false + labels: ${{ env.FORMATTED_BRANCH_NAME }} + cache-from: type=gha + cache-to: type=gha,mode=max + tags: | + ghcr.io/misskeyio/misskey:latest + ghcr.io/misskeyio/misskey:${{ env.FORMATTED_BRANCH_NAME }} From 242b8910f727f015f2c198be3775538c14634025 Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 18:35:53 +0900 Subject: [PATCH 07/14] Fix step name (Docker Hub -> GitHub Container Registry) --- .github/workflows/docker-io.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-io.yaml b/.github/workflows/docker-io.yaml index fd18d1f12a..612e02ac91 100644 --- a/.github/workflows/docker-io.yaml +++ b/.github/workflows/docker-io.yaml @@ -28,7 +28,7 @@ jobs: uses: docker/metadata-action@v4 with: images: ghcr.io/misskeyio/misskey - - name: Log in to Docker Hub + - name: Log in to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io @@ -37,7 +37,7 @@ jobs: - name: Prepare image tags run: | echo "FORMATTED_BRANCH_NAME=$(echo ${{ github.ref_name }} | sed -e 's/\//-/g' )" >> $GITHUB_ENV - - name: Build and Push to Docker Hub + - name: Build and Push to GitHub Container Registry uses: docker/build-push-action@v4 with: builder: ${{ steps.buildx.outputs.name }} From 08d2ca9b022de5706b0c79cc12795d6e354483d5 Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 18:38:55 +0900 Subject: [PATCH 08/14] Disable arm build --- .github/workflows/docker-io.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-io.yaml b/.github/workflows/docker-io.yaml index 612e02ac91..a43e439333 100644 --- a/.github/workflows/docker-io.yaml +++ b/.github/workflows/docker-io.yaml @@ -22,7 +22,7 @@ jobs: id: buildx uses: docker/setup-buildx-action@v2.5.0 with: - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 - name: Docker meta id: meta uses: docker/metadata-action@v4 From defe9d78c93068bd746e4e0afa9039cf2f346280 Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 19:00:02 +0900 Subject: [PATCH 09/14] Test cached build --- .github/workflows/docker-io.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-io.yaml b/.github/workflows/docker-io.yaml index a43e439333..3e47331351 100644 --- a/.github/workflows/docker-io.yaml +++ b/.github/workflows/docker-io.yaml @@ -4,7 +4,7 @@ on: push: tags: - # TODO: 後で消す + # TODO: 後で消すヨ branches: - migrate/github-actions From 5db1c74e9db87ade273e91062609c29147e48a3c Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 19:08:14 +0900 Subject: [PATCH 10/14] Remove test trigger --- .github/workflows/docker-io.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/docker-io.yaml b/.github/workflows/docker-io.yaml index 3e47331351..e524ffbe43 100644 --- a/.github/workflows/docker-io.yaml +++ b/.github/workflows/docker-io.yaml @@ -4,10 +4,6 @@ on: push: tags: - # TODO: 後で消すヨ - branches: - - migrate/github-actions - workflow_dispatch: jobs: From c22f5fb6c85c726293202473aee1c2d517d3376a Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 19:10:46 +0900 Subject: [PATCH 11/14] Fix tags resolution (maybe) --- .github/workflows/docker-io.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-io.yaml b/.github/workflows/docker-io.yaml index e524ffbe43..65f1c778c0 100644 --- a/.github/workflows/docker-io.yaml +++ b/.github/workflows/docker-io.yaml @@ -3,6 +3,7 @@ name: Publish Docker image (io) on: push: tags: + - * workflow_dispatch: From 78617695a6cf99ad0de5729c4f6d69febbfd473b Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 19:12:38 +0900 Subject: [PATCH 12/14] Fix tags resolution (2) (maybe) --- .github/workflows/docker-io.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-io.yaml b/.github/workflows/docker-io.yaml index 65f1c778c0..d803cd47f1 100644 --- a/.github/workflows/docker-io.yaml +++ b/.github/workflows/docker-io.yaml @@ -3,7 +3,7 @@ name: Publish Docker image (io) on: push: tags: - - * + - "**" workflow_dispatch: From 74fc946be416888d54940b86366d43eb3c9c1163 Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 19:15:38 +0900 Subject: [PATCH 13/14] Rename .yaml -> .yml --- .github/workflows/{docker-io.yaml => docker-io.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{docker-io.yaml => docker-io.yml} (100%) diff --git a/.github/workflows/docker-io.yaml b/.github/workflows/docker-io.yml similarity index 100% rename from .github/workflows/docker-io.yaml rename to .github/workflows/docker-io.yml From 385be641d866587bfcc38ed188e5e4b80cc31c14 Mon Sep 17 00:00:00 2001 From: Laica Lunasys Date: Sun, 9 Apr 2023 19:49:38 +0900 Subject: [PATCH 14/14] Fix setup-buildx-action version --- .github/workflows/docker-io.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-io.yml b/.github/workflows/docker-io.yml index d803cd47f1..1e8eff26d4 100644 --- a/.github/workflows/docker-io.yml +++ b/.github/workflows/docker-io.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v3 - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v2.5.0 + uses: docker/setup-buildx-action@v2 with: platforms: linux/amd64 - name: Docker meta