Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 125 additions & 4 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,154 @@ name: CLI
on:
push:
branches:
- main
- main
paths:
- .github/workflows/cli.yml
- cli/**
pull_request:
branches:
- main
- main
paths:
- .github/workflows/cli.yml
- cli/**

jobs:
CTF:
name: CTF
build:
name: Build and Verify
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Setup Go (required for CLI build)
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
go-version-file: cli/go.mod
cache-dependency-path: cli/go.sum

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Generate
run: task cli:generate/ctf

- name: Verify
run: task cli:verify/ctf

- name: Upload build artifacts (for release)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: cli-build-${{ github.run_id }}
if-no-files-found: error
path: |
cli/tmp/**

release:
name: Draft Release
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
sparse-checkout: cli
fetch-depth: 0
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: cli-build-${{ github.run_id }}
path: cli/tmp

- name: Extract Component Descriptor
working-directory: cli/tmp
run: |
chmod +x ./bin/ocm
./bin/ocm get cv \
./transport-archive//ocm.software/cli \
--logoutput stderr \
-oyaml > component-descriptor.yaml

yq .component.version component-descriptor.yaml > component-descriptor-version.txt

- name: changelog with git-cliff
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
args: |
--include-path "cli/**" \
--exclude-path "bindings/**/*" \
--tag-pattern "cli/**" \
-o cli/tmp/CHANGELOG.md \
--github-token ${{ secrets.GITHUB_TOKEN }}

- name: Generate Draft Release Notes
working-directory: cli/tmp
run: |
cat <<EOF > release-notes.md
# $(cat component-descriptor-version.txt)

This is a draft release of the next generation Open Component Model CLI, generated from the [latest commit at \`main\`](https://github.com/open-component-model/open-component-model/tree/main/cli).

> ⚠️ **Disclaimer:** This build is **unstable** and not intended for production use.
> It is unsigned, unverified, and the component descriptor is **not yet published** as a Component Transport Format (CTF). CTF support will be added in a future release.

## Getting Started

1. Download the latest CLI build from the release assets of this draft for your architecture.
2. Verify it works (you may need to add ocm to your PATH or make it executable):
\`\`\`sh
ocm version
\`\`\`
3. Explore the available commands in this build:
\`\`\`sh
ocm --help
\`\`\`

For more usage examples, see the current [OCM Development Documentation](https://ocm.software/dev/).
To engage with us, visit the [OCM Community](https://ocm.software/dev/community/engagement/).

## Additional Information

<details>
<summary>CHANGELOG.md</summary>

$(cat CHANGELOG.md)

</details>

<details>
<summary>component-descriptor.yaml</summary>

\`\`\`yaml
$(cat component-descriptor.yaml)
\`\`\`

</details>
EOF

- name: Create draft release
uses: softprops/action-gh-release@v2
with:
name: "OCM CLI – Latest (Unstable) Release"
draft: true
body_path: cli/tmp/release-notes.md
fail_on_unmatched_files: true
preserve_order: true
files: |
cli/tmp/component-descriptor.yaml
cli/tmp/bin/ocm-linux-*
cli/tmp/bin/ocm-darwin-*
cli/tmp/bin/ocm-windows-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Delete artifact
if: always()
uses: geekyeggo/delete-artifact@v5
with:
name: cli-build-${{ github.run_id }}
4 changes: 2 additions & 2 deletions cli/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ tasks:
- tmp/resources/ocm-{{ .GOOS }}-{{ .GOARCH }}.yaml
cmds:
- cmd: |
GOOS={{ .GOOS }} GOARCH={{ .GOARCH }} go build \
-ldflags "-X ocm.software/open-component-model/cli/cmd/version.BuildVersion={{ .VERSION }}" \
CGO_ENABLED=0 GOOS={{ .GOOS }} GOARCH={{ .GOARCH }} go build \
-ldflags "-extldflags=-static -w -s -X ocm.software/open-component-model/cli/cmd/version.BuildVersion={{ .VERSION }}" \
-o {{ .TASKFILE_DIR }}/tmp/bin/ocm-{{ .GOOS }}-{{ .GOARCH }}
- |
mkdir -p {{ .TASKFILE_DIR }}/tmp/resources
Expand Down
3 changes: 2 additions & 1 deletion renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
'security:openssf-scorecard',
'helpers:pinGitHubActionDigests',
':rebaseStalePrs',
':gitSignOff'
':gitSignOff',
':semanticCommitTypeAll(chore)'
],
'git-submodules': {
enabled: true
Expand Down
Loading