From 3e8b0778399bf55d08f7c93c94236e5c2b2086a3 Mon Sep 17 00:00:00 2001 From: SALTWOOD <105980161+SALTWOOD@users.noreply.github.com> Date: Sat, 25 May 2024 18:56:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20docker=20=E9=95=9C=E5=83=8F=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/on-dev.yml | 43 +++++++++++++++++++ .github/workflows/on-release.yml | 42 ++++++++++++++++++ .github/workflows/on-tag.yml | 43 +++++++++++++++++++ .../Modules/Storage/IStorage.cs | 2 - 4 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/on-dev.yml create mode 100644 .github/workflows/on-release.yml create mode 100644 .github/workflows/on-tag.yml diff --git a/.github/workflows/on-dev.yml b/.github/workflows/on-dev.yml new file mode 100644 index 0000000..53137e0 --- /dev/null +++ b/.github/workflows/on-dev.yml @@ -0,0 +1,43 @@ +name: Push image on dev + +on: + push: + branches: ["dev"] + workflow_dispatch: + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + if: false + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set environment + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Log in to Docker Hub + uses: docker/login-action@v3.1.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5.5.1 + with: + images: saltwood233/csharp-openbmclapi + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v5.3.0 + with: + context: . + file: ./Dockerfile + push: true + tags: saltwood233/csharp-openbmclapi:dev diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml new file mode 100644 index 0000000..6d7c8b5 --- /dev/null +++ b/.github/workflows/on-release.yml @@ -0,0 +1,42 @@ +name: Push image on master + +on: + push: + branches: ["master"] + workflow_dispatch: + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set environment + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Log in to Docker Hub + uses: docker/login-action@v3.1.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5.5.1 + with: + images: saltwood233/csharp-openbmclapi + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v5.3.0 + with: + context: . + file: ./Dockerfile + push: true + tags: saltwood233/csharp-openbmclapi diff --git a/.github/workflows/on-tag.yml b/.github/workflows/on-tag.yml new file mode 100644 index 0000000..4466a61 --- /dev/null +++ b/.github/workflows/on-tag.yml @@ -0,0 +1,43 @@ +name: Push image on tag + +on: + push: + tags: + - v* + workflow_dispatch: + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set environment + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Log in to Docker Hub + uses: docker/login-action@v3.1.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5.5.1 + with: + images: saltwood233/csharp-openbmclapi + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v5.3.0 + with: + context: . + file: ./Dockerfile + push: true + tags: saltwood233/csharp-openbmclapi:${{env.RELEASE_VERSION}} diff --git a/CSharp-OpenBMCLAPI/Modules/Storage/IStorage.cs b/CSharp-OpenBMCLAPI/Modules/Storage/IStorage.cs index c190c58..3ae52ae 100644 --- a/CSharp-OpenBMCLAPI/Modules/Storage/IStorage.cs +++ b/CSharp-OpenBMCLAPI/Modules/Storage/IStorage.cs @@ -5,8 +5,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using static System.Net.Mime.MediaTypeNames; -using static System.Runtime.InteropServices.JavaScript.JSType; namespace CSharpOpenBMCLAPI.Modules.Storage { ///