name: Gitea Release on: push: tags: ['v*'] workflow_dispatch: inputs: tag: description: Existing release tag matching pubspec version required: true permissions: contents: write actions: read concurrency: group: cutdex-release cancel-in-progress: false defaults: run: shell: pwsh env: PYTHONUTF8: '1' CUTDEX_GITEA_INTERNAL_URL: http://127.0.0.1:3000 GIT_CONFIG_COUNT: '2' GIT_CONFIG_KEY_0: core.autocrlf GIT_CONFIG_VALUE_0: 'false' GIT_CONFIG_KEY_1: core.eol GIT_CONFIG_VALUE_1: lf RELEASE_TAG: ${{ gitea.event.inputs.tag || gitea.ref_name }} GITEA_REPOSITORY: ${{ gitea.repository }} jobs: prepare: name: Prepare draft Release runs-on: cutdex-windows-x64 outputs: sha: ${{ steps.draft.outputs.sha }} release-id: ${{ steps.draft.outputs.release-id }} ci-run-id: ${{ steps.draft.outputs.ci-run-id }} artifact-id: ${{ steps.draft.outputs.artifact-id }} android-artifact-id: ${{ steps.draft.outputs.android-artifact-id }} windows-artifact-id: ${{ steps.draft.outputs.windows-artifact-id }} env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} steps: - name: Check out release tag uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: ref: ${{ gitea.event.inputs.tag || gitea.ref_name }} persist-credentials: false github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }} - name: Select successful CI and prepare draft id: draft run: | $env:GITEA_SHA = git rev-parse HEAD if ($LASTEXITCODE -ne 0) { throw 'Release source resolution failed.' } python tool/gitea/stage-release.py prepare-ci if ($LASTEXITCODE -ne 0) { throw 'CI selection or draft preparation failed.' } android: name: Upload Android to draft Release needs: prepare runs-on: cutdex-windows-x64 env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_SHA: ${{ needs.prepare.outputs.sha }} RELEASE_ID: ${{ needs.prepare.outputs.release-id }} CI_RUN_ID: ${{ needs.prepare.outputs.ci-run-id }} CI_ARTIFACT_ID: ${{ needs.prepare.outputs.android-artifact-id }} steps: - name: Check out release commit uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: ref: ${{ needs.prepare.outputs.sha }} persist-credentials: false github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }} - name: Download Android CI artifact run: | python tool/gitea/stage-release.py fetch-android --path .build/android if ($LASTEXITCODE -ne 0) { throw 'android CI artifact download failed.' } - name: Upload Android packages to draft run: | python tool/gitea/stage-release.py android --path .build/android if ($LASTEXITCODE -ne 0) { throw 'android draft upload failed.' } windows: name: Upload Windows to draft Release needs: prepare runs-on: cutdex-windows-x64 env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_SHA: ${{ needs.prepare.outputs.sha }} RELEASE_ID: ${{ needs.prepare.outputs.release-id }} CI_RUN_ID: ${{ needs.prepare.outputs.ci-run-id }} CI_ARTIFACT_ID: ${{ needs.prepare.outputs.windows-artifact-id }} steps: - name: Check out release commit uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: ref: ${{ needs.prepare.outputs.sha }} persist-credentials: false github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }} - name: Download Windows CI artifact run: | python tool/gitea/stage-release.py fetch-windows --path .build/windows if ($LASTEXITCODE -ne 0) { throw 'windows CI artifact download failed.' } - name: Upload Windows packages to draft run: | python tool/gitea/stage-release.py windows --path .build/windows if ($LASTEXITCODE -ne 0) { throw 'windows draft upload failed.' } publish: name: Verify and publish Release needs: [prepare, android, windows] runs-on: cutdex-windows-x64 env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_SHA: ${{ needs.prepare.outputs.sha }} RELEASE_ID: ${{ needs.prepare.outputs.release-id }} CI_RUN_ID: ${{ needs.prepare.outputs.ci-run-id }} CI_ARTIFACT_ID: ${{ needs.prepare.outputs.artifact-id }} steps: - name: Check out release commit uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: ref: ${{ needs.prepare.outputs.sha }} persist-credentials: false github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }} - name: Download release verification metadata run: | python tool/gitea/stage-release.py fetch-release --path dist if ($LASTEXITCODE -ne 0) { throw 'CI verification metadata validation failed.' } - name: Verify attachments and publish Release run: | python tool/gitea/stage-release.py publish --path dist if ($LASTEXITCODE -ne 0) { throw 'Release publication failed.' }