From 2c0cfb1b3eebc48c62ac9356ea897cfe52665378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Ramiro=20D=C3=ADaz?= Date: Sun, 18 Feb 2024 12:08:23 -0300 Subject: [PATCH 1/7] feat: add github action to build and push matchbox server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Agustín Ramiro Díaz --- .../push-matchbox_server-dockerhub.yml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/push-matchbox_server-dockerhub.yml diff --git a/.github/workflows/push-matchbox_server-dockerhub.yml b/.github/workflows/push-matchbox_server-dockerhub.yml new file mode 100644 index 00000000..4dc7008b --- /dev/null +++ b/.github/workflows/push-matchbox_server-dockerhub.yml @@ -0,0 +1,22 @@ +on: + push: + tags: + - "v*" + +name: Push `matchbox_server` to Docker Hub + +jobs: + build: + name: Login, Build and Push to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/matchbox_server:${{github.ref_name}} From bb1ed5f6aa8da0711f086f197169d79d97236de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Ramiro=20D=C3=ADaz?= Date: Sun, 18 Feb 2024 12:13:59 -0300 Subject: [PATCH 2/7] change username to be a variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Agustín Ramiro Díaz --- .github/workflows/push-matchbox_server-dockerhub.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push-matchbox_server-dockerhub.yml b/.github/workflows/push-matchbox_server-dockerhub.yml index 4dc7008b..184ee2e1 100644 --- a/.github/workflows/push-matchbox_server-dockerhub.yml +++ b/.github/workflows/push-matchbox_server-dockerhub.yml @@ -13,10 +13,10 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} + username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v5 with: push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/matchbox_server:${{github.ref_name}} + tags: ${{ vars.DOCKERHUB_USERNAME }}/matchbox_server:${{github.ref_name}} From a5bde14656d8d0e84bc513e29e490078dbc39906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Ramiro=20D=C3=ADaz?= Date: Sun, 18 Feb 2024 12:19:24 -0300 Subject: [PATCH 3/7] fix: update dockerfile path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Agustín Ramiro Díaz --- .github/workflows/push-matchbox_server-dockerhub.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/push-matchbox_server-dockerhub.yml b/.github/workflows/push-matchbox_server-dockerhub.yml index 184ee2e1..fe47c9a1 100644 --- a/.github/workflows/push-matchbox_server-dockerhub.yml +++ b/.github/workflows/push-matchbox_server-dockerhub.yml @@ -19,4 +19,5 @@ jobs: uses: docker/build-push-action@v5 with: push: true + file: matchbox_server/Dockerfile tags: ${{ vars.DOCKERHUB_USERNAME }}/matchbox_server:${{github.ref_name}} From 953809bd7c05a7e6190a80b33571f3776c239374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Ramiro=20D=C3=ADaz?= Date: Sun, 18 Feb 2024 12:30:06 -0300 Subject: [PATCH 4/7] add buildx for cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Agustín Ramiro Díaz --- .github/workflows/push-matchbox_server-dockerhub.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/push-matchbox_server-dockerhub.yml b/.github/workflows/push-matchbox_server-dockerhub.yml index fe47c9a1..0f754847 100644 --- a/.github/workflows/push-matchbox_server-dockerhub.yml +++ b/.github/workflows/push-matchbox_server-dockerhub.yml @@ -15,6 +15,8 @@ jobs: with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Build and push uses: docker/build-push-action@v5 with: From fc668e84f134e351682ba461c2e12376815cbdbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Ramiro=20D=C3=ADaz?= Date: Sun, 18 Feb 2024 17:48:27 -0300 Subject: [PATCH 5/7] improvement: build better tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Agustín Ramiro Díaz --- .../workflows/push-matchbox_server-dockerhub.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push-matchbox_server-dockerhub.yml b/.github/workflows/push-matchbox_server-dockerhub.yml index 0f754847..8aa24325 100644 --- a/.github/workflows/push-matchbox_server-dockerhub.yml +++ b/.github/workflows/push-matchbox_server-dockerhub.yml @@ -15,6 +15,15 @@ jobs: with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ vars.DOCKERHUB_USERNAME }}/matchbox_server + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push @@ -22,4 +31,6 @@ jobs: with: push: true file: matchbox_server/Dockerfile - tags: ${{ vars.DOCKERHUB_USERNAME }}/matchbox_server:${{github.ref_name}} + # Remove the 'v' from the tag + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 819beb62a872bbd6acda993979952600cf46810b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Ramiro=20D=C3=ADaz?= Date: Thu, 28 Mar 2024 12:17:44 -0300 Subject: [PATCH 6/7] fix: run code action in v* tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Agustín Ramiro Díaz --- .github/workflows/code.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index ebd7e612..4c80dfc4 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -2,6 +2,8 @@ on: push: branches: - main + tags: + - "v*" pull_request: name: Code From 1583749e5050cc57d1f405f83ff81d8ea54550f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Ramiro=20D=C3=ADaz?= Date: Thu, 28 Mar 2024 12:26:32 -0300 Subject: [PATCH 7/7] improvement: merge workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Agustín Ramiro Díaz --- .github/workflows/code.yml | 27 ++++++++------ .../push-matchbox_server-dockerhub.yml | 36 ------------------- 2 files changed, 17 insertions(+), 46 deletions(-) delete mode 100644 .github/workflows/push-matchbox_server-dockerhub.yml diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 4c80dfc4..08c0d3c9 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -75,7 +75,6 @@ jobs: - name: Run cargo clippy run: cargo fmt --all --check - lint-native: name: Lints native strategy: @@ -117,14 +116,14 @@ jobs: - name: Run cargo clippy run: RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy > - --all-targets - --target wasm32-unknown-unknown - -p matchbox_socket - -p bevy_matchbox - -p bevy_ggrs_example - -p simple_example - -- - -D warnings + --all-targets + --target wasm32-unknown-unknown + -p matchbox_socket + -p bevy_matchbox + -p bevy_ggrs_example + -p simple_example + -- + -D warnings server-container: name: Build & Push Server Container @@ -147,11 +146,19 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Docker Metadata id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.IMAGE_REPOSITORY }} + images: | + ${{ env.IMAGE_REPOSITORY }} + ${{ vars.DOCKERHUB_USERNAME }}/matchbox_server tags: | type=ref,event=tag type=raw,value=latest diff --git a/.github/workflows/push-matchbox_server-dockerhub.yml b/.github/workflows/push-matchbox_server-dockerhub.yml deleted file mode 100644 index 8aa24325..00000000 --- a/.github/workflows/push-matchbox_server-dockerhub.yml +++ /dev/null @@ -1,36 +0,0 @@ -on: - push: - tags: - - "v*" - -name: Push `matchbox_server` to Docker Hub - -jobs: - build: - name: Login, Build and Push to Docker Hub - runs-on: ubuntu-latest - steps: - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ vars.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ${{ vars.DOCKERHUB_USERNAME }}/matchbox_server - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - push: true - file: matchbox_server/Dockerfile - # Remove the 'v' from the tag - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }}