From e74a9e5eb6892e453e8251c624c0d38431689993 Mon Sep 17 00:00:00 2001 From: Bas Dingemans Date: Thu, 28 Dec 2023 20:53:35 +0100 Subject: [PATCH] CI Testing --- .github/workflows/release.yml | 121 ++++++++++++++++------------------ package.json | 2 +- 2 files changed, 59 insertions(+), 64 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f52d190..8aa0d30 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,92 +1,87 @@ name: Create Snapshot on: - push: + push: branches: - master - workflow_dispatch: - + workflow_dispatch: -jobs: - - # Validate Repository Configuration - config: - runs-on: ubuntu-latest - outputs: - config_package: ${{ steps.config_package.outputs.configPackage }} - steps: +env: + PACKAGE_JSON: "./package.json" - # Ensure that required repository variable has been created for the Package - - name: Validate Package Config - id: config_package - run: | - if [ "${{ vars.PACKAGE_NAME }}" != "" ]; then - echo "configPackage=true" >> $GITHUB_OUTPUT; - else - echo "configPackage=false" >> $GITHUB_OUTPUT; - fi +jobs: # Build and release the Package # If the repository is not configured properly, this job will be skipped build: - needs: config runs-on: ubuntu-latest permissions: contents: write - env: - packagePath: "." - #packagePath: Packages/${{ vars.PACKAGE_NAME }} - if: needs.config.outputs.config_package == 'true' steps: - - # Checkout Local Repository - name: Checkout - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac + uses: actions/checkout@v4.1.1 + with: + ref: ${{ github.head_ref }} + fetch-depth: 0 + fetch-tags: true + lfs: true + submodules: true + set-safe-directory: true + + + - name: Get package properties + id: package_data + uses: zoexx/github-action-json-file-properties@1.0.4 + with: + file_path: "${{ env.PACKAGE_JSON }}" + + - name: 'Get Previous tag' + id: previous_tag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + with: + fallback: 0.3.0 + + - name: Parse git tag version + id: tag_version + uses: madhead/semver-utils@v3.1.0 + with: + lenient: false + version: ${{ steps.previous_tag.outputs.tag }} + compare-to: ${{ steps.package_data.outputs.version }} + + - name: Track Package Meta Files + run: find "." -name \*.meta >> metaList - # Get the Package version based on the package.json file - - name: Get Version - id: version - uses: zoexx/github-action-json-file-properties@b9f36ce6ee6fe2680cd3c32b2c62e22eade7e590 - with: - file_path: "${{ env.packagePath }}/package.json" - prop_path: "version" - - # Configure the Environment Variables needed for releasing the Package - - name: Set Environment Variables + - name: Set version number (patch increase) + id: new_patch_version + if: ${{ steps.tag_version.outputs.comparison-result == '>' || steps.tag_version.outputs.comparison-result == '=' }} + run: | + echo "version=${{ steps.tag_version.outputs.inc-patch }}" >> $GITHUB_ENV + echo "unityPackage=${{ steps.package_data.outputs.name }}-${{ env.version }}.unitypackage" >> $GITHUB_ENV + + - name: Set version number (json) + id: new_version + if: ${{ steps.tag_version.outputs.comparison-result == '<' }} run: | - echo "zipFile=${{ vars.PACKAGE_NAME }}-${{ steps.version.outputs.value }}".zip >> $GITHUB_ENV - echo "unityPackage=${{ vars.PACKAGE_NAME }}-${{ steps.version.outputs.value }}.unitypackage" >> $GITHUB_ENV - echo "version=${{ steps.version.outputs.value }}" >> $GITHUB_ENV + echo "version=${{ steps.package_data.outputs.version }}" >> $GITHUB_ENV + echo "unityPackage=${{ steps.package_data.outputs.name }}-${{ steps.package_data.outputs.version }}.unitypackage" >> $GITHUB_ENV + - # Zip the Package for release - - name: Create Package Zip - working-directory: "${{ env.packagePath }}" - run: zip -r "${{ github.workspace }}/${{ env.zipFile }}" . - - # Build a list of .meta files for future use - - name: Track Package Meta Files - run: find "${{ env.packagePath }}/" -name \*.meta >> metaList - - # Make a UnityPackage version of the Package for release - name: Create UnityPackage - uses: pCYSl5EDgo/create-unitypackage@cfcd3cf0391a5ef1306342794866a9897c32af0b + uses: pCYSl5EDgo/create-unitypackage@v1.1.1 with: - package-path: ${{ env.unityPackage }} + package-path: "${{ env.unityPackage }}" include-files: metaList - - # Make a release tag of the version from the package.json file + - name: Create Tag - id: tag_version - uses: rickstaa/action-create-tag@88dbf7ff6fe2405f8e8f6c6fdfd78829bc631f83 + uses: rickstaa/action-create-tag@v1.7.2 with: tag: "${{ env.version }}" - # Publish the Release to GitHub - name: Make Release - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 + uses: softprops/action-gh-release@v0.1.15 with: files: | - ${{ env.zipFile }} - ${{ env.unityPackage }} - ${{ env.packagePath }}/package.json - tag_name: ${{ env.version }} \ No newline at end of file + ./*.unitypackage + ${{ env.PACKAGE_JSON }} + tag_name: "${{ env.version }}" diff --git a/package.json b/package.json index e1a26b6..820037e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name" : "tk.dingemans.bigibas123.ndmfvrcfreorder", "displayName" : "NDMF VRCF Reorderer", - "version" : "0.3.0-beta", + "version" : "0.3.0", "license": "EPL-2.0", "author": { "name": "bigibas123"