diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2653288..2857af3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,35 +14,59 @@ name: Bazel +# Needed for creating releases +permissions: + contents: write + on: - pull_request: {} + pull_request: + branches: [main] + push: {} release: types: [published] + workflow_dispatch: + inputs: + create_release: + description: "Create GitHub release" + type: boolean + default: false + version: + description: "Release version" + required: false + type: string + upload_to_registry: + description: "Upload to package registry" + type: boolean + default: false jobs: - build-and-test: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: actions/cache@v4 - with: - path: | - ~/.cache/bazelisk - ~/.cache/bazel - key: bazel-${{ hashFiles('common.bazelrc', '.bazelrc', '.bazelversion', 'WORKSPACE', 'MODULE.bazel', 'requirements.txt') }} - restore-keys: bazel- - - run: bazelisk test //... + # FIXME + # build-and-test: + # runs-on: ubuntu-22.04 + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/cache@v4 + # with: + # path: | + # ~/.cache/bazelisk + # ~/.cache/bazel + # key: bazel-${{ hashFiles('common.bazelrc', '.bazelrc', '.bazelversion', 'WORKSPACE', 'MODULE.bazel', 'requirements.txt') }} + # restore-keys: bazel- + # - run: bazelisk test //... build-and-upload-tools: - needs: [build-and-test] + # FIXME + # needs: [build-and-test] strategy: matrix: # Only the go_binary targets support cross-compilation at the moment: target: - //agent/cmd/agent - //tools/nbictl/cmd/nbictl - os: [linux, windows, darwin] + # FIXME + # os: [linux, windows, darwin] + os: [linux, darwin] arch: [amd64, arm64] runs-on: ubuntu-latest @@ -81,23 +105,54 @@ jobs: with: name: agent-${{ matrix.os }}-${{ matrix.arch }} path: bazel-bin/agent/cmd/agent/agent_/agent.exe + + # FIXME + # build-and-upload-docs: + # needs: [build-and-test] + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/cache@v4 + # with: + # path: | + # ~/.cache/bazelisk + # ~/.cache/bazel + # key: bazel-${{ hashFiles('common.bazelrc', '.bazelrc', '.bazelversion', 'WORKSPACE', 'MODULE.bazel', 'requirements.txt') }} + # restore-keys: bazel- + # - run: bazelisk build "//api:api.html" + # - name: Upload API docs + # uses: actions/upload-artifact@v4 + # with: + # name: api.html + # path: | + # bazel-bin/api/api.html/api.html - build-and-upload-docs: - needs: [build-and-test] + create-release: + needs: [build-and-upload-tools] runs-on: ubuntu-latest + # FIXME + # if: | + # github.event_name == 'workflow_dispatch' && + # inputs.create_release == true + steps: - uses: actions/checkout@v4 - - uses: actions/cache@v4 - with: - path: | - ~/.cache/bazelisk - ~/.cache/bazel - key: bazel-${{ hashFiles('common.bazelrc', '.bazelrc', '.bazelversion', 'WORKSPACE', 'MODULE.bazel', 'requirements.txt') }} - restore-keys: bazel- - - run: bazelisk build "//api:api.html" - - name: Upload API docs - uses: actions/upload-artifact@v4 + + - name: Download all artifacts + uses: actions/download-artifact@v4 + + - name: Create Release + uses: softprops/action-gh-release@v2 with: - name: api.html - path: | - bazel-bin/api/api.html/api.html + # FIXME + # tag_name: ${{ inputs.version }} + # name: FIXME Release ${{ inputs.version }} + tag_name: FIXME-test-release-${{ github.ref_name }} + name: FIXME Release ${{ github.ref_name }} + draft: true + files: | + nbictl-* + agent-* + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} \ No newline at end of file