diff --git a/.github/utils/pack.js b/.github/utils/pack.js index d4117f1..04628f3 100644 --- a/.github/utils/pack.js +++ b/.github/utils/pack.js @@ -5,9 +5,9 @@ var generateEvb = require('generate-evb'); // Change the following paths to the actual paths used in your project var evbCliPath = 'enigmavbconsole.exe'; var projectName = 'SDUNetCheckTool.evb'; -var inputExe = '../../SduNetCheckTool.GUI/bin/Debug/SduNetCheckTool.GUI.exe'; +var inputExe = '../../SduNetCheckTool.GUI/bin/Release/SduNetCheckTool.GUI.exe'; var outputExe = '../../build/SduNetCheckTool.GUI_boxed.exe'; -var path2Pack = '../../SduNetCheckTool.GUI/bin/Debug'; +var path2Pack = '../../SduNetCheckTool.GUI/bin/Release'; generateEvb(projectName, inputExe, outputExe, path2Pack); diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1ef723..2242128 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,32 +8,37 @@ on: push: branches: - master + workflow_call: jobs: build: strategy: matrix: targetplatform: [x64] - Configuration: [Debug] - ChannelName: [Prod_Store] + Configuration: [Release] runs-on: windows-latest env: - appPackagesArchive: AppPackages.zip - # appPackagesDirectory: bin\x64\${{ matrix.Configuration }} + # artifacts 命名 [名字]-[commit-hash] + artifactName: SduNetCheckTool-${{ github.sha }} + appPackagesArchive: SduNetCheckTool-${{ github.sha }}.zip + appPackagesExecutable: SduNetCheckTool-${{ github.sha }}.exe + solutionPath: SduNetCheckTool.sln coreProjectDirectory: SduNetCheckTool.Core guiProjectDirectory: SduNetCheckTool.GUI coreProjectPath: SduNetCheckTool.Core\SduNetCheckTool.Core.csproj guiProjectPath: SduNetCheckTool.GUI\SduNetCheckTool.GUI.csproj - Configuration: Debug - appPackagesDirectory: bin\Debug + Configuration: Release + appPackagesDirectory: bin\Release steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v2 + with: + node-version: '16' - name: Install .NET Core uses: actions/setup-dotnet@v3 @@ -44,7 +49,7 @@ jobs: uses: microsoft/setup-msbuild@v1.1 - name: Restore the Wpf application - run: msbuild ${{ env.solutionPath }} /t:Restore /p:Configuration=${{ matrix.Configuration }} /p:RuntimeIdentifier=win + run: msbuild ${{ env.solutionPath }} /t:Restore /p:Configuration=${{ env.Configuration }} /p:RuntimeIdentifier=win - name: Build wapproj run: msbuild ${{ env.solutionPath }} /p:Configuration=${{env.Configuration}} /p:UapAppxPackageBuildMode=StoreUpload /p:AppxBundle=Never /p:GenerateAppInstallerFile=False /p:AppxPackageSigningEnabled=False @@ -54,23 +59,19 @@ jobs: mkdir build Compress-Archive -Path ${{ env.guiProjectDirectory }}\${{ env.appPackagesDirectory }}\* -DestinationPath build\${{ env.appPackagesArchive }} - - name: install node - uses: actions/setup-node@v2 - with: - node-version: '16.x' - - name: Pack into single file executable run: | cd .\.github\utils\ npm install node pack.js cd - + Move-Item build\SduNetCheckTool.GUI_boxed.exe build\${{ env.appPackagesExecutable }} - name: 'Upload Artifact' uses: actions/upload-artifact@v3 with: - name: my-artifact + name: ${{ env.artifactName }} path: | build/${{ env.appPackagesArchive }} - build/SduNetCheckTool.GUI_boxed.exe - retention-days: 5 + build/${{ env.appPackagesExecutable }} + retention-days: 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 398ffdf..409d409 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,32 +1,47 @@ # Copyright SduNetCheckTool # Licensed under the GNU General Public License v3.0 -name: Release +name: Build and Release on: - [release, workflow_dispatch] + release: + types: [created] + # filter on draft releases only jobs: build: + uses: ./.github/workflows/build.yml + + relase: + needs: build runs-on: ubuntu-latest + + env: + # app 命名 [名字]-[commit-tag] + artifact_name: SduNetCheckTool-${{ github.sha }} + steps: - name: Checkout uses: actions/checkout@v2 - - name: Build + - name: Download Artifact + uses: actions/download-artifact@v2 + with: + name: ${{ env.artifact_name }} + + - name: Display Artifact run: | - echo "Building..." - echo "Build complete." + ls -l + mv ${{ env.artifact_name }}.zip SduNetCheckTool-${{ github.ref_name }}.zip + mv ${{ env.artifact_name }}.exe SduNetCheckTool-${{ github.ref_name }}.exe - name: Create Release uses: softprops/action-gh-release@v1 with: files: | - build/${{ env.appPackagesArchive }} - build/SduNetCheckTool.GUI_boxed.exe + SduNetCheckTool-${{ github.ref_name }}.zip + SduNetCheckTool-${{ github.ref_name }}.exe LICENSE.txt - tag_name: 0.0.1 - body: | - This is an automated release of this Wpf application. + tag_name: ${{ github.ref_name }} draft: false prerelease: false token: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..903ce13 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,29 @@ +name: Test for environment variables + +on: + release: + types: [created] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: echo env + run: | + echo "github.event_name = ${{ github.event_name }}" + echo "github.ref = ${{ github.ref }}" + echo "github.ref_name = ${{ github.ref_name }}" + echo "github.sha = ${{ github.sha }}" + echo "github.repository = ${{ github.repository }}" + echo "github.repository_owner = ${{ github.repository_owner }}" + echo "github.run_id = ${{ github.run_id }}" + echo "github.run_number = ${{ github.run_number }}" + echo "github.actor = ${{ github.actor }}" + echo "github.workflow = ${{ github.workflow }}" + echo "github.head_ref = ${{ github.head_ref }}" + echo "github.base_ref = ${{ github.base_ref }}" + echo "github.event_path = ${{ github.event_path }}" + echo "github.workspace = ${{ github.workspace }}" + echo "github.action = ${{ github.action }}" + \ No newline at end of file