|
| 1 | +name: publish |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - v* |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | + |
| 9 | +permissions: |
| 10 | + packages: write |
| 11 | + |
| 12 | +env: |
| 13 | + OCI_URL: ghcr.io/openmcp-project |
| 14 | + |
| 15 | +jobs: |
| 16 | + release_tag: |
| 17 | + name: Release version |
| 18 | + runs-on: ubuntu-24.04 |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + ssh-key: ${{ secrets.PUSH_KEY }} |
| 24 | + fetch-tags: true |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - name: Read and validate VERSION |
| 28 | + id: version |
| 29 | + run: | |
| 30 | + VERSION=$(cat VERSION) |
| 31 | + if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-dev)?$ ]]; then |
| 32 | + echo "Invalid version format in VERSION file: $VERSION" |
| 33 | + exit 1 |
| 34 | + fi |
| 35 | + echo "New version: $VERSION" |
| 36 | + echo "version=$VERSION" >> $GITHUB_ENV |
| 37 | +
|
| 38 | + - name: Skip release if version is a dev version |
| 39 | + if: contains(env.version, '-dev') |
| 40 | + run: | |
| 41 | + echo "Skipping development version release: ${{ env.version }}" |
| 42 | + echo "SKIP=true" >> $GITHUB_ENV |
| 43 | + exit 0 |
| 44 | +
|
| 45 | + - name: Set up QEMU |
| 46 | + uses: docker/setup-qemu-action@v2 |
| 47 | + |
| 48 | + - name: Set up Docker Context for Buildx |
| 49 | + id: buildx-context |
| 50 | + run: | |
| 51 | + docker context create builders |
| 52 | +
|
| 53 | + - name: Login to GitHub Container Registry |
| 54 | + uses: docker/login-action@v3 |
| 55 | + with: |
| 56 | + registry: ghcr.io |
| 57 | + username: ${{ github.actor }} |
| 58 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + |
| 60 | + - name: Set up Docker Buildx |
| 61 | + timeout-minutes: 5 |
| 62 | + uses: docker/setup-buildx-action@v2 |
| 63 | + with: |
| 64 | + version: latest |
| 65 | + |
| 66 | + - name: Set up Go |
| 67 | + uses: actions/setup-go@v5 |
| 68 | + with: |
| 69 | + go-version-file: go.mod |
| 70 | + |
| 71 | + - name: Build the ${{ github.repository }} |
| 72 | + run: | |
| 73 | + make prepare-release |
| 74 | + make build |
| 75 | +
|
| 76 | + - name: Build Images |
| 77 | + run: | |
| 78 | + IMAGE_REGISTRY=ghcr.io/openmcp-project make image-build |
| 79 | +
|
| 80 | + - name: setup OCM |
| 81 | + uses: open-component-model/ocm-setup-action@main |
| 82 | + |
| 83 | + - name: Create OCM CTF |
| 84 | + run: | |
| 85 | + ocm add componentversions --create \ |
| 86 | + --file ctf component-constructor.yaml \ |
| 87 | + --settings settings.yaml -- VERSION=${{ env.version }} |
| 88 | +
|
| 89 | + - name: Push CTF |
| 90 | + run: | |
| 91 | + ocm transfer ctf --overwrite ./ctf ${{ env.OCI_URL }} |
0 commit comments