| Filename | Latest commit message | Latest commit date |
|---|---|---|
| README.md | ||
c4-cli-action
forgejo action to put codesys 4 in a pipeline
Doing this will completely streamline your CI/CD setup. Instead of writing a custom Runner application, you can package this setup logic into a Reusable Workflow or a Composite GitHub Action and publish it to a public repository on GitHub. Because Forgejo is designed to be natively compatible with the GitHub Actions syntax, any custom Action or Workflow you publish to GitHub can be pulled directly into your Forgejo pipelines. [1] (https://www.youtube.com/watch?v=ciHJzV6TZB8), [2] (https://www.linkedin.com/pulse/reusing-workflows-github-actions-guilherme-moura-neezf) The structural tradeoffs to consider, along with how to package this for your stack, include:
Option A: Create a Composite GitHub Action (Recommended)
A composite action packages multiple script steps into a single reusable unit. This is exactly how tools like setup-node or setup-python work. [1] (https://www.youtube.com/watch?v=ciHJzV6TZB8)
You would create a repository on GitHub named setup-codesys4-cli. Inside it, you just need a single action.yml file:
# action.yml
name: 'Setup CODESYS 4 c4-cli'
description: 'Downloads and extracts the standalone c4-cli headless tool for Linux runners.'
inputs:
codesys_version:
description: 'The URL or version string of the CODESYS 4 debian package'
required: false
default: 'https://codesys.com'
runs:
using: 'composite'
steps:
- name: Download package
shell: bash
run: curl -L -o codesys4_amd64.deb "${{ inputs.codesys_version }}"
- name: Extract Standalone c4-cli
shell: bash
run: |
mkdir -p local_c4
dpkg-deb -x codesys4_amd64.deb ./local_c4
- name: Add to Path
shell: bash
run: echo "$(pwd)/local_c4/usr/bin" >> $GITHUB_PATH
How you would use it in Forgejo or GitHub:
Once published to your-github-username/setup-codesys4-cli, your repository pipelines (whether on Forgejo or GitHub) become incredibly clean:
steps:
- uses: actions/checkout@v4
- name: Install CODESYS 4 CLI
uses: your-github-username/setup-codesys4-cli@v1
- name: Build
run: c4-cli bootapp compile
Pulling it into Forgejo
Because Forgejo runners execute actions by cloning them dynamically, your Forgejo instance will reach out to GitHub, pull down your custom composite action code, and execute it locally on your Ubuntu server runner seamlessly.