diff --git a/.github/workflows/app-release.yml b/.github/workflows/app-release.yml index e89aeb0..5ba56da 100644 --- a/.github/workflows/app-release.yml +++ b/.github/workflows/app-release.yml @@ -82,7 +82,7 @@ jobs: Supervisely-Release: needs: Update-App-Config - uses: supervisely-ecosystem/workflows/.github/workflows/common.yml@master + uses: supervisely/agent/.github/workflows/workflows-common.yml@master secrets: SUPERVISELY_DEV_API_TOKEN: "${{ secrets.SUPERVISELY_DEV_API_TOKEN }}" SUPERVISELY_PRIVATE_DEV_API_TOKEN: "${{ secrets.SUPERVISELY_PRIVATE_DEV_API_TOKEN }}" diff --git a/.github/workflows/build-push-dev.yml b/.github/workflows/build-push-dev.yml index 5677baf..730518c 100644 --- a/.github/workflows/build-push-dev.yml +++ b/.github/workflows/build-push-dev.yml @@ -10,6 +10,12 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.12" + - name: Write Tag to ENV variable run: echo "BRANCH_NAME=${{ github.event.release.tag_name }}" >> $GITHUB_ENV @@ -24,10 +30,10 @@ jobs: --local dockerfile=. \ --output type=image,name=supervisely/agent:dev,push=true \ --opt provenance=false \ - --opt build-arg=LABEL_VERSION=6.999.0 \ - --opt build-arg=LABEL_INFO=${{ env.LABEL_INFO }} \ - --opt build-arg=LABEL_MODES=${{ env.LABEL_MODES }} \ - --opt build-arg=LABEL_README=${{ env.LABEL_README }} \ - --opt build-arg=LABEL_BUILT_AT=${{ env.LABEL_BUILT_AT }} \ + --opt build-arg:LABEL_VERSION=6.999.0 \ + --opt build-arg:LABEL_INFO=${{ env.LABEL_INFO }} \ + --opt build-arg:LABEL_MODES=${{ env.LABEL_MODES }} \ + --opt build-arg:LABEL_README=${{ env.LABEL_README }} \ + --opt build-arg:LABEL_BUILT_AT=${{ env.LABEL_BUILT_AT }} \ --import-cache type=registry,ref=supervisely/agent:dev-cache \ --export-cache type=registry,ref=supervisely/agent:dev-cache,mode=max diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index c2b93aa..5f822f5 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -12,6 +12,11 @@ jobs: - name: Checkout uses: actions/checkout@v6 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.12" + - name: Echo ${{ github.event.release.tag_name }} run: echo ${{ github.event.release.tag_name }} @@ -31,11 +36,11 @@ jobs: --local dockerfile=. \ --output type=image,name=supervisely/agent:${{ env.LABEL_VERSION }},push=true \ --opt provenance=false \ - --opt build-arg=LABEL_VERSION=agent:${{ env.LABEL_VERSION }} \ - --opt build-arg=LABEL_INFO=${{ env.LABEL_INFO }} \ - --opt build-arg=LABEL_MODES=${{ env.LABEL_MODES }} \ - --opt build-arg=LABEL_README=${{ env.LABEL_README }} \ - --opt build-arg=LABEL_BUILT_AT=${{ env.LABEL_BUILT_AT }} \ + --opt build-arg:LABEL_VERSION=agent:${{ env.LABEL_VERSION }} \ + --opt build-arg:LABEL_INFO=${{ env.LABEL_INFO }} \ + --opt build-arg:LABEL_MODES=${{ env.LABEL_MODES }} \ + --opt build-arg:LABEL_README=${{ env.LABEL_README }} \ + --opt build-arg:LABEL_BUILT_AT=${{ env.LABEL_BUILT_AT }} \ --import-cache type=registry,ref=supervisely/agent:cache \ --export-cache type=registry,ref=supervisely/agent:cache,mode=max @@ -44,7 +49,7 @@ jobs: permissions: contents: write actions: write - uses: supervisely/agent/.github/workflows/app-release.yml@app-release + uses: supervisely/agent/.github/workflows/app-release.yml@master secrets: SUPERVISELY_DEV_API_TOKEN: "${{ secrets.SUPERVISELY_DEV_API_TOKEN }}" SUPERVISELY_PRIVATE_DEV_API_TOKEN: "${{ secrets.SUPERVISELY_PRIVATE_DEV_API_TOKEN }}" diff --git a/.github/workflows/manual-app-release.yml b/.github/workflows/manual-app-release.yml index 2fa9480..2a7f310 100644 --- a/.github/workflows/manual-app-release.yml +++ b/.github/workflows/manual-app-release.yml @@ -17,7 +17,7 @@ jobs: permissions: contents: write actions: write - uses: supervisely/agent/.github/workflows/app-release.yml@app-release + uses: supervisely/agent/.github/workflows/app-release.yml@master secrets: SUPERVISELY_DEV_API_TOKEN: "${{ secrets.SUPERVISELY_DEV_API_TOKEN }}" SUPERVISELY_PRIVATE_DEV_API_TOKEN: "${{ secrets.SUPERVISELY_PRIVATE_DEV_API_TOKEN }}" diff --git a/.github/workflows/manual-build-push-release.yml b/.github/workflows/manual-build-push-release.yml index d98dcb3..001bd1c 100644 --- a/.github/workflows/manual-build-push-release.yml +++ b/.github/workflows/manual-build-push-release.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: tag_version: - description: "Docker Image Tag" + description: "Docker Image Tag (without 'v' prefix)" required: true default: "" release_description: @@ -20,6 +20,11 @@ jobs: - name: Checkout uses: actions/checkout@v6 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.12" + - name: Tag Version run: echo ${{ github.event.inputs.tag_version }} @@ -37,11 +42,11 @@ jobs: --local dockerfile=. \ --output type=image,name=supervisely/agent:${{ env.LABEL_VERSION }},push=true \ --opt provenance=false \ - --opt build-arg=LABEL_VERSION=agent:${{ env.LABEL_VERSION }} \ - --opt build-arg=LABEL_INFO=${{ env.LABEL_INFO }} \ - --opt build-arg=LABEL_MODES=${{ env.LABEL_MODES }} \ - --opt build-arg=LABEL_README=${{ env.LABEL_README }} \ - --opt build-arg=LABEL_BUILT_AT=${{ env.LABEL_BUILT_AT }} \ + --opt build-arg:LABEL_VERSION=agent:${{ env.LABEL_VERSION }} \ + --opt build-arg:LABEL_INFO=${{ env.LABEL_INFO }} \ + --opt build-arg:LABEL_MODES=${{ env.LABEL_MODES }} \ + --opt build-arg:LABEL_README=${{ env.LABEL_README }} \ + --opt build-arg:LABEL_BUILT_AT=${{ env.LABEL_BUILT_AT }} \ --import-cache type=registry,ref=supervisely/agent:cache \ --export-cache type=registry,ref=supervisely/agent:cache,mode=max @@ -50,7 +55,7 @@ jobs: permissions: contents: write actions: write - uses: supervisely/agent/.github/workflows/app-release.yml@app-release + uses: supervisely/agent/.github/workflows/app-release.yml@master secrets: SUPERVISELY_DEV_API_TOKEN: "${{ secrets.SUPERVISELY_DEV_API_TOKEN }}" SUPERVISELY_PRIVATE_DEV_API_TOKEN: "${{ secrets.SUPERVISELY_PRIVATE_DEV_API_TOKEN }}" @@ -59,5 +64,5 @@ jobs: with: SUPERVISELY_SERVER_ADDRESS: "${{ vars.SUPERVISELY_DEV_SERVER_ADDRESS }}" SUPERVISELY_PROD_SERVER_ADDRESS: "${{ vars.SUPERVISELY_PROD_SERVER_ADDRESS }}" - RELEASE_VERSION: "${{ inputs.tag_version }}" + RELEASE_VERSION: "v${{ inputs.tag_version }}" RELEASE_DESCRIPTION: "${{ inputs.release_description }}" diff --git a/.github/workflows/workflows-common.yml b/.github/workflows/workflows-common.yml new file mode 100644 index 0000000..05f60bb --- /dev/null +++ b/.github/workflows/workflows-common.yml @@ -0,0 +1,122 @@ +name: Supervisely release +run-name: Supervisely ${{ github.repository }} app release +on: + workflow_call: + inputs: + SUPERVISELY_SERVER_ADDRESS: + required: true + type: string + SUPERVISELY_PROD_SERVER_ADDRESS: + required: true + type: string + SLUG: + required: true + type: string + RELEASE_VERSION: + required: true + type: string + RELEASE_DESCRIPTION: + required: true + type: string + SUBAPP_PATHS: + required: true + type: string + RELEASE_TYPE: + required: true + type: string + SKIP_INSTANCE_VERSION_VALIDATION: + required: false + type: boolean + default: false + SKIP_IMAGE_VALIDATION: + required: false + type: boolean + default: false + ARCHIVE_ONLY_CONFIG: + required: false + type: boolean + default: false + COMMIT_SHA: + required: false + type: string + default: "" + MODELS_PATH: + required: false + type: string + default: "" + FRAMEWORK: + required: false + type: string + default: "" + RELEASE_MODELS: + required: false + type: boolean + default: false + secrets: + SUPERVISELY_DEV_API_TOKEN: + required: true + SUPERVISELY_PRIVATE_DEV_API_TOKEN: + required: true + SUPERVISELY_PROD_API_TOKEN: + required: true + GH_ACCESS_TOKEN: + required: true + +jobs: + Supervisely-Release: + runs-on: gha-runner-supervisely + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ inputs.COMMIT_SHA }} + fetch-depth: 0 + + - uses: actions/checkout@v6 + with: + repository: supervisely-ecosystem/workflows + path: workflow + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libgl1 libmagic1 skopeo + python -m venv venv + . venv/bin/activate + python -m pip install --upgrade pip + pip install -r ./workflow/requirements.txt + + - name: Supervisely Release + run: | + . venv/bin/activate + python ./workflow/release.py + env: + DEV_SERVER_ADDRESS: "${{ inputs.SUPERVISELY_SERVER_ADDRESS }}" + PROD_SERVER_ADDRESS: "${{ inputs.SUPERVISELY_PROD_SERVER_ADDRESS }}" + DEV_API_TOKEN: "${{ secrets.SUPERVISELY_DEV_API_TOKEN }}" + PRIVATE_DEV_API_TOKEN: "${{ secrets.SUPERVISELY_PRIVATE_DEV_API_TOKEN }}" + PROD_API_TOKEN: "${{ secrets.SUPERVISELY_PROD_API_TOKEN }}" + GH_ACCESS_TOKEN: "${{ secrets.GH_ACCESS_TOKEN }}" + SLUG: "${{ inputs.SLUG }}" + RELEASE_VERSION: "${{ inputs.RELEASE_VERSION }}" + RELEASE_DESCRIPTION: "${{ inputs.RELEASE_DESCRIPTION }}" + RELEASE_TYPE: "${{ inputs.RELEASE_TYPE }}" + SUBAPP_PATHS: "${{ inputs.SUBAPP_PATHS }}" + SKIP_INSTANCE_VERSION_VALIDATION: "${{ inputs.SKIP_INSTANCE_VERSION_VALIDATION }}" + SKIP_IMAGE_VALIDATION: "${{ inputs.SKIP_IMAGE_VALIDATION }}" + ARCHIVE_ONLY_CONFIG: "${{ inputs.ARCHIVE_ONLY_CONFIG }}" + + Models-release: + needs: Supervisely-Release + if: inputs.RELEASE_MODELS && inputs.RELEASE_TYPE != 'release-branch' + uses: supervisely/agent/.github/workflows/workflows-sync-models-common.yml@master + secrets: + API_TOKEN: "${{ secrets.SUPERVISELY_PROD_API_TOKEN }}" + with: + SERVER_ADDRESS: "${{ vars.SUPERVISELY_PROD_SERVER_ADDRESS }}" + MODELS_PATH: "${{ inputs.MODELS_PATH }}" + FRAMEWORK: "${{ inputs.FRAMEWORK }}" diff --git a/.github/workflows/workflows-sync-models-common.yml b/.github/workflows/workflows-sync-models-common.yml new file mode 100644 index 0000000..15a9e12 --- /dev/null +++ b/.github/workflows/workflows-sync-models-common.yml @@ -0,0 +1,53 @@ +name: Sync Models +on: + workflow_call: + inputs: + MODELS_PATH: + type: string + required: false + DET_MODELS_PATH: + type: string + required: false + FRAMEWORK: + type: string + required: true + SERVER_ADDRESS: + type: string + required: true + secrets: + API_TOKEN: + required: true + +jobs: + release-models: + runs-on: gha-runner-supervisely + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + repository: supervisely-ecosystem/workflows + path: workflow + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + sudo apt-get update + python -m venv venv + . venv/bin/activate + python -m pip install --upgrade pip + pip install -r workflow/requirements.txt + + - name: Sync models + run: | + . venv/bin/activate + python workflow/release_models.py + env: + SERVER_ADDRESS: ${{ inputs.SERVER_ADDRESS }} + API_TOKEN: ${{ secrets.API_TOKEN }} + MODELS_PATH: ${{ inputs.MODELS_PATH }} + DET_MODELS_PATH: ${{ inputs.DET_MODELS_PATH }} + FRAMEWORK: ${{ inputs.FRAMEWORK }}