From dfd82e6d40b60cc8fa9379ba39a180ac5d1c752d Mon Sep 17 00:00:00 2001 From: Alan Rynne Date: Tue, 13 Aug 2024 18:43:49 +0200 Subject: [PATCH] feat: Add GitVersion to sketchup CI run (#363) * feat: Add GitVersion to sketchup CI run * fix: Temp trigger from my branch * feat: Separate build and deploy jobs * fix: Missing value field on build workflow * fix: Job names * fix: Remove on push for build job * fix: Pull request trigger * fix: Only trigger on dui3/alpha branch --- .github/workflows/build.yml | 53 +++++++++++++++++++ .../{build_installer.yml => deploy.yml} | 34 +----------- GitVersion.yml | 12 +++++ 3 files changed, 67 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/build.yml rename .github/workflows/{build_installer.yml => deploy.yml} (53%) create mode 100644 GitVersion.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f69763f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,53 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Build + +on: + pull_request: + workflow_call: + outputs: + version: + description: "The computed version number for this run" + value: ${{ jobs.build.outputs.version }} + +jobs: + build: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.set-version.outputs.version }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v3.0.0 + with: + versionSpec: "5.x" + + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v3.0.0 + + - name: Set connector version + run: | + python patch_version.py ${{steps.gitversion.outputs.semVer}} + + - uses: montudor/action-zip@v1 + with: + args: zip -q -r sketchup.zip vendor speckle_connector_3/ speckle_connector_3.rb + - name: ⬆️ Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: output-${{steps.gitversion.outputs.semVer}} + path: sketchup.zip + compression-level: 0 # no compression + - id: set-version + name: Set version to output + run: echo "version=${{steps.gitversion.outputs.semVer}}" >> "$GITHUB_OUTPUT" # version will be retrieved from tag? diff --git a/.github/workflows/build_installer.yml b/.github/workflows/deploy.yml similarity index 53% rename from .github/workflows/build_installer.yml rename to .github/workflows/deploy.yml index c883a86..40c1921 100644 --- a/.github/workflows/build_installer.yml +++ b/.github/workflows/deploy.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Build installer +name: Build and deploy on: push: @@ -10,36 +10,7 @@ on: jobs: build: - - runs-on: ubuntu-latest - outputs: - version: ${{ steps.set-version.outputs.version }} - - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - # TODO: Generate version!!!!! - - - name: Set connector version - run: | - python patch_version.py 3.0.0-alpha - - uses: montudor/action-zip@v1 - with: - args: zip -q -r sketchup.zip vendor speckle_connector_3/ speckle_connector_3.rb - - name: ⬆️ Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: output-3.0.0-alpha - path: sketchup.zip - compression-level: 0 # no compression - - id: set-version - name: Set version to output - run: echo "version=3.0.0-alpha" >> "$GITHUB_OUTPUT" # version will be retrieved from tag? - + uses: ./.github/workflows/build.yml deploy-installers: runs-on: ubuntu-latest @@ -58,4 +29,3 @@ jobs: wait-for-completion-timeout: 10m display-workflow-run-url: true display-workflow-run-url-interval: 10s - diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..2672518 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,12 @@ +next-version: 3.0.0 +mode: ContinuousDeployment +assembly-informational-format: "{Major}.{Minor}.{Patch}-{PreReleaseTag}" +branches: + main: + regex: ^main$ + tag: rc + develop: + regex: ^development$ + tag: dev + pull-request: + tag: pr