Add ocm-based publish action #8
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: publish | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| workflow_dispatch: | |
| pull_request: | |
| permissions: | |
| packages: write | |
| env: | |
| OCI_URL: ghcr.io/openmcp-project | |
| jobs: | |
| release_tag: | |
| name: Release version | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ssh-key: ${{ secrets.PUSH_KEY }} | |
| fetch-tags: true | |
| fetch-depth: 0 | |
| - name: Read and validate VERSION | |
| id: version | |
| run: | | |
| VERSION=$(cat VERSION) | |
| if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-dev)?$ ]]; then | |
| echo "Invalid version format in VERSION file: $VERSION" | |
| exit 1 | |
| fi | |
| echo "New version: $VERSION" | |
| echo "version=$VERSION" >> $GITHUB_ENV | |
| - name: Skip release if version is a dev version | |
| if: contains(env.version, '-dev') | |
| run: | | |
| echo "Skipping development version release: ${{ env.version }}" | |
| echo "SKIP=true" >> $GITHUB_ENV | |
| exit 0 | |
| - name: setup OCM | |
| uses: open-component-model/ocm-setup-action@main | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Context for Buildx | |
| id: buildx-context | |
| run: | | |
| docker context create builders | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| timeout-minutes: 5 | |
| uses: docker/setup-buildx-action@v2 | |
| with: | |
| version: latest | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build the project-workspace-operator | |
| run: | | |
| # make prepare-release | |
| make build | |
| - name: Build Images | |
| run: | | |
| IMAGE_REGISTRY=ghcr.io/openmcp-project make image-build | |
| - name: Create OCM CTF | |
| uses: open-component-model/ocm-action@main | |
| with: | |
| action: add_component | |
| components: component-constructor.yaml | |
| settings: settings.yaml | |
| directory: . | |
| version_cmd: "cat ./VERSION" | |
| - name: Push CTF | |
| run: | | |
| ocm transfer ctf gen/ocm/ctf ghcr.io/openmcp-project --enforce |