feat: add release workflow #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release-linux-x86_64: | |
| name: Release (linux-x86_64) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake ninja-build g++ jq | |
| - name: Extract version | |
| id: version | |
| run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| - name: Setup vcpkg | |
| uses: lukka/run-vcpkg@v11 | |
| with: | |
| vcpkgGitCommitId: "66c0373dc7fca549e5803087b9487edfe3aca0a1" | |
| doNotCache: false | |
| - name: Setup Python and dependencies | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| cache-dependency-path: requirements-lock.txt | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -r requirements-lock.txt | |
| - name: Configure | |
| run: cmake --preset ci-linux-release-strict | |
| - name: Build | |
| run: cmake --build --preset ci-linux-release-strict --parallel | |
| - name: Test | |
| run: ctest --preset ci-linux-release-strict -L provider | |
| - name: Package binary artifact | |
| id: package | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| ARTIFACT="anolis-provider-sim-${VERSION}-linux-x86_64.tar.gz" | |
| BINARY="build/ci-linux-release-strict/anolis-provider-sim" | |
| if [ ! -f "${BINARY}" ]; then | |
| echo "ERROR: binary not found at ${BINARY}" >&2 | |
| exit 1 | |
| fi | |
| mkdir -p staging/bin | |
| cp "${BINARY}" staging/bin/ | |
| tar -czf "${ARTIFACT}" -C staging . | |
| echo "artifact=${ARTIFACT}" >> "$GITHUB_OUTPUT" | |
| - name: Package source tarball | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| git archive --format=tar.gz \ | |
| --prefix="anolis-provider-sim-${VERSION}/" \ | |
| -o "anolis-provider-sim-${VERSION}-source.tar.gz" \ | |
| HEAD | |
| - name: Generate checksums | |
| run: sha256sum anolis-provider-sim-*.tar.gz > SHA256SUMS | |
| - name: Generate manifest | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| ARTIFACT="${{ steps.package.outputs.artifact }}" | |
| SHA=$(grep "${ARTIFACT}" SHA256SUMS | awk '{print $1}') | |
| jq -n \ | |
| --argjson schema_version 1 \ | |
| --arg repo "anolishq/anolis-provider-sim" \ | |
| --arg component "anolis_provider_sim" \ | |
| --arg version "${VERSION}" \ | |
| --arg platform "linux-x86_64" \ | |
| --arg asset "${ARTIFACT}" \ | |
| --arg sha256 "${SHA}" \ | |
| '{schema_version: $schema_version, repo: $repo, component: $component, version: $version, platform: $platform, asset: $asset, sha256: $sha256}' \ | |
| > manifest.json | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| anolis-provider-sim-*.tar.gz | |
| SHA256SUMS | |
| manifest.json | |
| generate_release_notes: true |