Skip to content
Merged
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
7 changes: 6 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
# Check for updates to GitHub Actions every month
interval: "monthly"
groups:
# Bundle all GitHub Actions updates into a single pull request
github-actions:
patterns:
- "*"
25 changes: 12 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches:
- main
- 'releases/**'
tags:
- v*
pull_request:
branches:
- main
Expand All @@ -19,28 +17,29 @@ jobs:
timeout-minutes: 60
steps:
- name: Check out the repo
uses: actions/checkout@v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ghcr.io/openmodelica/crossbuild

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
id: build-image
uses: docker/build-push-action@v6
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: ./Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
# Only push when this is NOT a pull_request (avoid GHCR write for PRs)
push: ${{ github.event_name != 'pull_request' }}
Expand All @@ -55,7 +54,7 @@ jobs:

- name: Upload image artifact for pull_request runs
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: crossbuild-image
path: crossbuild-image.tar
Expand Down Expand Up @@ -95,10 +94,10 @@ jobs:
timeout-minutes: 15
steps:
- name: Check out the repo
uses: actions/checkout@v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -115,7 +114,7 @@ jobs:

- name: Download and load image artifact for pull_request runs
if: github.event_name == 'pull_request'
uses: actions/download-artifact@v7
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: crossbuild-image
path: ./image
Expand Down Expand Up @@ -149,7 +148,7 @@ jobs:
done <<< "$IMAGES"

- name: Upload Interaction1.fmu
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Interaction1-${{ matrix.toolchain }}
path: test/resources/Interaction1.fmu
Expand All @@ -171,12 +170,12 @@ jobs:
timeout-minutes: 30
steps:
- name: Download Interaction1.fmu
uses: actions/download-artifact@v7
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ matrix.fmu_artifact }}

- name: Install OMSimulator
uses: OpenModelica/setup-openmodelica@v1.0
uses: OpenModelica/setup-openmodelica@dd6dc5fdb91c936dd3ab328902808c8a5421f146 # v1.1.0
with:
version: '1'
packages: |
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: Publish Docker Image

# Publishing is driven by Git tags: every pushed `v*` tag is built, pushed and
# signed here. Creating a GitHub release from a new tag pushes that tag as well,
# so the release flow is covered too. Tags that already exist can be
# (re-)published with `workflow_dispatch` on the tag.
on:
release:
types: [published]
push:
tags:
- 'v*'
workflow_dispatch:

# Required for cosign keyless (OIDC) to mint tokens
Expand All @@ -18,27 +23,27 @@ jobs:
timeout-minutes: 60
steps:
- name: Check out the repo
uses: actions/checkout@v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install cosign
uses: sigstore/cosign-installer@v4.0.0
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2

- name: Login to GitHub Container Registry
uses: docker/login-action@v3.6.0
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5.8.0
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ghcr.io/openmodelica/crossbuild

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6.18.0
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: ./Dockerfile
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ LABEL organization="OpenModelica"

LABEL org.opencontainers.image.vendor="OpenModelica"
LABEL org.opencontainers.image.authors="AnHeuermann"
LABEL org.opencontainers.image.version="v1.26.0-dev"
LABEL org.opencontainers.image.description="Cross-compile C FMUs for Linux and Windows"
LABEL org.opencontainers.image.source="https://github.com/OpenModelica/openmodelica-crossbuild/"
LABEL org.opencontainers.image.license="AGPL VERSION 3 OR OSMC-PL VERSION 1.8"
Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,35 @@ cmake --build build_linux64 --target create_fmu

### Release Versions

The [publish.yml][gh-publish-file] workflow will build, sign and
upload the Docker image to
[GitHub container registry][gh-container-registry] for each release.
The [publish.yml][gh-publish-file] workflow builds, uploads and **signs** the
Docker image in the [GitHub container registry][gh-container-registry] for every
pushed `v*` Git tag. It publishes the tag itself (e.g. `v1.27.0`) as well as
`latest`. Creating a GitHub release from a new tag pushes that tag too, so
releases are covered by the same workflow. To (re-)publish an already existing
tag, run [publish.yml][gh-publish-workflow] via *Run workflow* and select the
tag.

Release tags are published exclusively by this workflow, so that no unsigned
image can end up under a `v*` or `latest` tag.

### Development Versions

The [build.yml][gh-build-file] workflow uploads all tested image versions to
[GitHub container registry][gh-container-registry].
The [build.yml][gh-build-file] workflow uploads all tested image versions of the
`main` and `releases/**` branches to the
[GitHub container registry][gh-container-registry]. These images are tagged with
their branch name (e.g. `main`) and are **not signed**.

## Verifying Signature

> [!CAUTION]
> Only download and run images you trust.

You can use `cosign` to verify the keyless signature from
[publish.yml][gh-publish-file]:
[publish.yml][gh-publish-file]. Only `v*` release tags and `latest` are signed;
branch images such as `main` are not.

```bash
export TAG=v1.26.0
export TAG=v1.27.0
cosign verify ghcr.io/openmodelica/crossbuild:$TAG \
--certificate-identity=https://github.com/OpenModelica/openmodelica-crossbuild/.github/workflows/publish.yml@refs/tags/$TAG \
--certificate-oidc-issuer=https://token.actions.githubusercontent.com
Expand Down
Loading