From d890efadfc09f0549a82fbab23473ba67904537a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=9D=E5=B8=9D=E7=86=99=E6=81=A9?= <111548550+THEXN@users.noreply.github.com> Date: Tue, 12 Mar 2024 00:41:29 +0800 Subject: [PATCH] Create main.yml --- .github/workflows/main.yml | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..64c8ef1 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,55 @@ +name: Build + +# Controls when the workflow will run +on: + push: + pull_request: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.100' + - name: Set custom tag name + run: | + SHA=$(echo $GITHUB_SHA | cut -c1-7) + echo "SHORT_SHA=$SHA" >> $GITHUB_ENV + shell: bash + + - name: Build the solution + run: dotnet build -c Release --output out/ + + - name: Prepare Upload + run: + rm -rf out/*.json + rm -rf out/HttpServer.dll + - name: Upload Plugin + uses: actions/upload-artifact@v3 + with: + name: Plugin + path: out/* + + - name: Release + uses: softprops/action-gh-release@v1 + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + env: + SHORT_SHA: ${{ env.SHORT_SHA }} + with: + prerelease: true + tag_name: ${{ env.SHORT_SHA }} + name: Build + files: + out/*