14
71
Fork
You've already forked meta
4

Examples and how to #10

Open
opened 2025年01月06日 00:32:45 +01:00 by fnetX · 9 comments
Owner
Copy link

Did you create a pipeline that you'd like to share? Something you are proud of? Or just a repo that others could take a look at for inspiration?

Share your pipelines here with a link to the project where they are used in.

Did you create a pipeline that you'd like to share? Something you are proud of? Or just a repo that others could take a look at for inspiration? Share your pipelines here with a link to the project where they are used in.

Yesterday, I was able to setup a pipeline to:

  • Build a Flutter app for Web
  • Push the output to the Codeberg Pages repo

The pipeline:

on:push:tags:- 'v*'jobs:energize-build-web:runs-on:codeberg-small-lazysteps:- name:Checkout App to 'epinez/Energize/Energize'uses:https://code.forgejo.org/actions/checkout@v4with:path:Energizesubmodules:recursivefetch-depth:0- name:Flutter Setuprun:| cd Energize
 sed -i "/'tar', '-xzf'/s/'-xzf'/'--no-same-owner', '-xzf'/" submodules/flutter/packages/flutter_tools/lib/src/base/os.dart
 submodules/flutter/bin/flutter config --no-analytics - name:Flutter Prebuildrun:| cd Energize
 submodules/flutter/bin/flutter pub get
 submodules/flutter/bin/dart run build_runner build --delete-conflicting-outputs - name:Flutter Build Webrun:| cd Energize
 submodules/flutter/bin/flutter build web --release --base-href "/projects/energize/" - name:Checkout Pages to 'epinez/Energize/pages'uses:https://code.forgejo.org/actions/checkout@v4with:repository:epinez/pagesref:mainpath:pagesssh-key:${{ secrets.SSH_PUSH_KEY }}ssh-known-hosts:${{ secrets.CI_KNOWN_HOSTS }}- name:Deploy Energize to Codeberg Pagesrun:| rm -r pages/projects/energize/*
 cp -r Energize/build/web/* pages/projects/energize/
 git -C pages config user.name "forgejo-actions[bot]"
 git -C pages config user.email "epinez@noreply.codeberg.org"
 git -C pages add projects/energize
 git -C pages commit -m "Deploy current Energize version"
 git -C pages push

It is only mandatory to:

  • Setup a deploy key on the Pages repo
  • Add the corresponding Forgejo Action secrets:
    • SSH_PUSH_KEY
    • CI_KNOWN_HOSTS (Fingerprint of Codeberg.org)

Works flawless so far. 🙂

Yesterday, I was able to setup a pipeline to: - Build a Flutter app for Web - Push the output to the Codeberg Pages repo The pipeline: ```yaml on: push: tags: - 'v*' jobs: energize-build-web: runs-on: codeberg-small-lazy steps: - name: Checkout App to 'epinez/Energize/Energize' uses: https://code.forgejo.org/actions/checkout@v4 with: path: Energize submodules: recursive fetch-depth: 0 - name: Flutter Setup run: | cd Energize sed -i "/'tar', '-xzf'/s/'-xzf'/'--no-same-owner', '-xzf'/" submodules/flutter/packages/flutter_tools/lib/src/base/os.dart submodules/flutter/bin/flutter config --no-analytics - name: Flutter Prebuild run: | cd Energize submodules/flutter/bin/flutter pub get submodules/flutter/bin/dart run build_runner build --delete-conflicting-outputs - name: Flutter Build Web run: | cd Energize submodules/flutter/bin/flutter build web --release --base-href "/projects/energize/" - name: Checkout Pages to 'epinez/Energize/pages' uses: https://code.forgejo.org/actions/checkout@v4 with: repository: epinez/pages ref: main path: pages ssh-key: ${{ secrets.SSH_PUSH_KEY }} ssh-known-hosts: ${{ secrets.CI_KNOWN_HOSTS }} - name: Deploy Energize to Codeberg Pages run: | rm -r pages/projects/energize/* cp -r Energize/build/web/* pages/projects/energize/ git -C pages config user.name "forgejo-actions[bot]" git -C pages config user.email "epinez@noreply.codeberg.org" git -C pages add projects/energize git -C pages commit -m "Deploy current Energize version" git -C pages push ``` It is only mandatory to: - Setup a deploy key on the Pages repo - Add the corresponding Forgejo Action secrets: - SSH_PUSH_KEY - CI_KNOWN_HOSTS (Fingerprint of Codeberg.org) Works flawless so far. 🙂

Here is my simple pipeline for python using UV for dependencies and RUFF for lint/format:

name:Pythonon:workflow_dispatch:pull_request:types:[labeled]jobs:test:name:Testif:github.event_name == 'workflow_dispatch' || github.event.label.name == 'trigger_pipeline'runs-on:codeberg-tiny-lazycontainer:image:ghcr.io/catthehacker/ubuntu:act-lateststeps:- uses:https://code.forgejo.org/actions/checkout@v4with:fetch-depth:1- name:Install uvrun:pip install uv- name:Ruff checkrun:uvx ruff check .- name:Install the projectrun:uv sync --all-extras --dev- name:Run testsrun:uv run python -m unittest discover tests

And a second pipeline to publish your package to pipy again, using uv (using a pypi token saved in the secret named PYPI_TOKEN):

name:Publish Pypion:workflow_dispatch:push:tags:- "*"jobs:publish:name:Publishruns-on:codeberg-tiny-lazycontainer:image:ghcr.io/catthehacker/ubuntu:act-lateststeps:- uses:https://code.forgejo.org/actions/checkout@v4with:fetch-depth:1- name:Install uvrun:pip install uv- name:Publishrun:| uv build
 uv publish --token ${{ secrets.PYPI_TOKEN }}
Here is my simple pipeline for python using UV for dependencies and RUFF for lint/format: ```yml name: Python on: workflow_dispatch: pull_request: types: [labeled] jobs: test: name: Test if: github.event_name == 'workflow_dispatch' || github.event.label.name == 'trigger_pipeline' runs-on: codeberg-tiny-lazy container: image: ghcr.io/catthehacker/ubuntu:act-latest steps: - uses: https://code.forgejo.org/actions/checkout@v4 with: fetch-depth: 1 - name: Install uv run: pip install uv - name: Ruff check run: uvx ruff check . - name: Install the project run: uv sync --all-extras --dev - name: Run tests run: uv run python -m unittest discover tests ``` And a second pipeline to publish your package to pipy again, using uv (using a pypi token saved in the secret named PYPI_TOKEN): ```yml name: Publish Pypi on: workflow_dispatch: push: tags: - "*" jobs: publish: name: Publish runs-on: codeberg-tiny-lazy container: image: ghcr.io/catthehacker/ubuntu:act-latest steps: - uses: https://code.forgejo.org/actions/checkout@v4 with: fetch-depth: 1 - name: Install uv run: pip install uv - name: Publish run: | uv build uv publish --token ${{ secrets.PYPI_TOKEN }} ```

I also have a workflow that publishes as Codeberg Pages using Lektor:

on: 
 push:
 branches:
 - 'main'
jobs:
 deploy:
 runs-on: codeberg-tiny-lazy
 steps:
 - uses: https://code.forgejo.org/actions/checkout@v4
 with:
 path: build
 - uses: https://code.forgejo.org/actions/checkout@v4
 with:
 ref: 'pages'
 path: deploy
 - uses: https://code.forgejo.org/actions/setup-python@v5
 with:
 python-version: 3.12
 - run: pip install -r build/requirements.txt
 - run: cd build && lektor build
 - run: |
 set -e
 cd deploy
 rm -r *
 cp -r ../build/dist/* .
 git config user.name "forgejo-action[bot]"
 git config user.email "<your-username>@noreply.codeberg.org"
 git add -A 
 git commit --allow-empty -m "Auto-commit by Action #$GITHUB_RUN_NUMBER" -m "Build from $GITHUB_SHA"
 git push

The difference to @epinez approach is that both the source code and the final page are in the same repo as different branches ('main' and 'pages').

Thank you for providing this service! Once I found this repository, the workflow was straightforward to set up.

I also have a workflow that publishes as Codeberg Pages using [Lektor](https://www.getlektor.com/): ``` on: push: branches: - 'main' jobs: deploy: runs-on: codeberg-tiny-lazy steps: - uses: https://code.forgejo.org/actions/checkout@v4 with: path: build - uses: https://code.forgejo.org/actions/checkout@v4 with: ref: 'pages' path: deploy - uses: https://code.forgejo.org/actions/setup-python@v5 with: python-version: 3.12 - run: pip install -r build/requirements.txt - run: cd build && lektor build - run: | set -e cd deploy rm -r * cp -r ../build/dist/* . git config user.name "forgejo-action[bot]" git config user.email "<your-username>@noreply.codeberg.org" git add -A git commit --allow-empty -m "Auto-commit by Action #$GITHUB_RUN_NUMBER" -m "Build from $GITHUB_SHA" git push ``` The difference to @epinez approach is that both the source code and the final page are in the same repo as different branches ('main' and 'pages'). Thank you for providing this service! Once I found this repository, the workflow was straightforward to set up.

Hello,

I succeded with the following actions file:

on:[push]jobs:check-format:runs-on:codeberg-tiny-lazysteps:# Check out the repository.- uses:https://code.forgejo.org/actions/checkout@v4# Install stylua.- run:wget "https://github.com/JohnnyMorganz/StyLua/releases/latest/download/stylua-linux-x86_64.zip"- run:unzip stylua-linux-x86_64.zip- run:chmod a+x stylua# Check styling.- run:./stylua --check ftplugin/ lua/

I could not run this action using an alpine image as checkout failed due to a missing node installation. Thus, I used the default image and manually installed stylua (stylua is present in the alpine repositories).

Thanks to all people involved in this and for making this possible!

Hello, I succeded with the following actions file: ```yaml on: [push] jobs: check-format: runs-on: codeberg-tiny-lazy steps: # Check out the repository. - uses: https://code.forgejo.org/actions/checkout@v4 # Install stylua. - run: wget "https://github.com/JohnnyMorganz/StyLua/releases/latest/download/stylua-linux-x86_64.zip" - run: unzip stylua-linux-x86_64.zip - run: chmod a+x stylua # Check styling. - run: ./stylua --check ftplugin/ lua/ ``` I could not run this action using an alpine image as checkout failed due to a missing node installation. Thus, I used the default image and manually installed stylua (stylua is present in the alpine repositories). Thanks to all people involved in this and for making this possible!

I took on the challenge to see if I could run my library tests on all the 8 supported versions of Python in under 2 minutes on a regular tiny instance.
I at first optimised it too much as it turns out one needs nodejs:20 to do the checkout actions.
Eventually I settled on the default node:20 debian base image, and then installed uv and used it to install all the python versions and ran the tests using tox.

This is what I ended up with that works for me, it consistently runs in under 1 minute 😄:

name:Run testson:workflow_dispatch:pull_request:push:branches:- 'main'jobs:test:name:Testsruns-on:codeberg-tinysteps:- uses:https://code.forgejo.org/actions/checkout@v4with:fetch-depth:1- name:Install all python versionsrun:| curl -LsSf https://astral.sh/uv/install.sh | sh
 ln -s /root/.local/bin/uv /usr/local/bin/uv
 uv python install --no-progress cpython-3.14 cpython-3.13 cpython-3.12 cpython-3.11 cpython-3.10 cpython-3.9 cpython-3.8 pypy-3.11
 uv pip install --system tox tox-uv- name:Run toxrun:tox r --result-json result.json

I'm not 100% happy using remote-code execution to install uv and then use their build artefacts. I'd rather use a public docker image that has node and all the python versions installed so the runner can cache more effectively.

Thanks for the hints I found here to make this work!

I took on the challenge to see if I could run my library tests on all the 8 supported versions of Python in under 2 minutes on a regular tiny instance. I at first optimised it too much as it turns out one needs nodejs:20 to do the checkout actions. Eventually I settled on the default node:20 debian base image, and then installed `uv` and used it to install all the python versions and ran the tests using tox. This is what I ended up with that works for me, it consistently runs in under 1 minute 😄: ```yaml name: Run tests on: workflow_dispatch: pull_request: push: branches: - 'main' jobs: test: name: Tests runs-on: codeberg-tiny steps: - uses: https://code.forgejo.org/actions/checkout@v4 with: fetch-depth: 1 - name: Install all python versions run: | curl -LsSf https://astral.sh/uv/install.sh | sh ln -s /root/.local/bin/uv /usr/local/bin/uv uv python install --no-progress cpython-3.14 cpython-3.13 cpython-3.12 cpython-3.11 cpython-3.10 cpython-3.9 cpython-3.8 pypy-3.11 uv pip install --system tox tox-uv - name: Run tox run: tox r --result-json result.json ``` I'm not 100% happy using remote-code execution to install `uv` and then use their build artefacts. I'd rather use a public docker image that has node and all the python versions installed so the runner can cache more effectively. Thanks for the hints I found here to make this work!

I have now a latex pipeline that I run on a self-hosted forgejo instance:

name:Compile docson:workflow_dispatch:pull_request:types:[labeled]jobs:test:name:Latex documentif:github.event_name == 'workflow_dispatch' || github.event.label.name == 'trigger_pipeline'runs-on:codeberg-tinycontainer:image:registry.gitlab.com/islandoftex/images/texlive:lateststeps:- run:apt update && apt install -y nodejs- uses:https://code.forgejo.org/actions/checkout@v4with:fetch-depth:1- name:Compile CVrun:lualatex a_document.tex 

It uses a latex docker image and install node on it to be able to use the checkout action

I have now a latex pipeline that I run on a self-hosted forgejo instance: ```yml name: Compile docs on: workflow_dispatch: pull_request: types: [labeled] jobs: test: name: Latex document if: github.event_name == 'workflow_dispatch' || github.event.label.name == 'trigger_pipeline' runs-on: codeberg-tiny container: image: registry.gitlab.com/islandoftex/images/texlive:latest steps: - run: apt update && apt install -y nodejs - uses: https://code.forgejo.org/actions/checkout@v4 with: fetch-depth: 1 - name: Compile CV run: lualatex a_document.tex ``` It uses a latex docker image and install node on it to be able to use the checkout action
Please find here my MWE for LaTeX compiling (with pdflatex) using files on Git-LFS with a "small" TexLive container:
on:push:branches:- mainjobs:pdflatex:runs-on:codeberg-tiny-lazycontainer:image:ghcr.io/xu-cheng/texlive-alpine-small:lateststeps:- run:apk update && apk add nodejs git-lfs # needed for checkout- uses:https://data.forgejo.org/actions/checkout@v4with:lfs:true# needed for included images stored with Git-LFS- run:tlmgr install cleveref # needed for extra packages, e.g. cleveref- run:pdflatex document.tex && pdflatex document.tex- uses:https://data.forgejo.org/forgejo/upload-artifact@v4with:name:document.pdfpath:document.pdfcompression-level:0# no compression
<details><summary>Please find here my MWE for LaTeX compiling (with pdflatex) using files on Git-LFS with a "small" TexLive container:</summary> ```yml on: push: branches: - main jobs: pdflatex: runs-on: codeberg-tiny-lazy container: image: ghcr.io/xu-cheng/texlive-alpine-small:latest steps: - run: apk update && apk add nodejs git-lfs # needed for checkout - uses: https://data.forgejo.org/actions/checkout@v4 with: lfs: true # needed for included images stored with Git-LFS - run: tlmgr install cleveref # needed for extra packages, e.g. cleveref - run: pdflatex document.tex && pdflatex document.tex - uses: https://data.forgejo.org/forgejo/upload-artifact@v4 with: name: document.pdf path: document.pdf compression-level: 0 # no compression ``` </details>

And here, a very simple pipeline to synchronize a master branch with the development branch main (it works flawlessly for many of my repositories, e.g. in /spiky):

on:push:branches:- mainjobs:sync:runs-on:codeberg-tinysteps:- name:checkout mainuses:actions/checkout@v4- name:push to masterrun:git push --force origin main:master
<details><summary> And here, a very simple pipeline to synchronize a `master` branch with the development branch `main` (it works flawlessly for many of my repositories, e.g. in [[/spiky]]): </summary> ```yml on: push: branches: - main jobs: sync: runs-on: codeberg-tiny steps: - name: checkout main uses: actions/checkout@v4 - name: push to master run: git push --force origin main:master ``` </details>

I've set up self hosted Actions and used it to port my deploy to PyPI off Github

name:Publish Packageon:# to *test* this, temporarily enable test.pypi.org (below) and trigger the# build by making a tag at https://codeberg.org/kousu/radicale-bsdauth/releases/new# pointed at the branch under test. It has to be a valid version string, but# you can mark it with ".dev" to keep it out of the way: increment the most recent published version# e.g. v2.3.2 -> v2.3.3.dev1, then v2.3.3.dev2, v2.3.3.dev3 etc.# Also consider enabling test.pypi.org below.release:types:[published]jobs:publish:name:Publish Packageruns-on:ubuntu-lateststeps:- name:Install CI Tools# on my self-hosted runner, the runner image is missing these tools.run:| DEBIAN_FRONTEND=noninteractive apt update
 DEBIAN_FRONTEND=noninteractive apt install -y nodejs jq curl wget- uses:actions/checkout@v3- uses:actions/setup-python@v3- name:Install dependenciesrun:| pip install build- name:Buildrun:python -m build- name:Publish Releaseuses:actions/forgejo-release@v2with:direction:uploadoverride:truerelease-dir:dist/sha256sum:truetoken:${{ secrets.FORGEJO_TOKEN }}- name:Publish to PyPIif:secrets.PYPI_TOKEN != ''uses:https://github.com/pypa/gh-action-pypi-publish@release/v1with:user:__token__password:${{ secrets.PYPI_TOKEN }}# TESTING:# repository-url: https://test.pypi.org/legacy/# password: ${{ secrets.TEST_PYPI_TOKEN }}

This published straight to https://test.pypi.org/project/radicale-bsdauth/1.0.2.dev6/ and to https://codeberg.org/kousu/radicale-bsdauth/releases/tag/v1.0.2.dev6. The next time I actually have cause to make a release it will go to https://pypi.org/project/radicale-bsdauth/1.0.2 and https://codeberg.org/kousu/radicale-bsdauth/releases/tag/v1.0.2.

I've set up [self hosted Actions](https://codeberg.org/kousu/codeberg-actions/src/branch/trunk/README.md#fn:user-content-opt) and used it to [port my deploy to PyPI off Github](https://codeberg.org/kousu/radicale-bsdauth/pulls/2) ```yaml name: Publish Package on: # to *test* this, temporarily enable test.pypi.org (below) and trigger the # build by making a tag at https://codeberg.org/kousu/radicale-bsdauth/releases/new # pointed at the branch under test. It has to be a valid version string, but # you can mark it with ".dev" to keep it out of the way: increment the most recent published version # e.g. v2.3.2 -> v2.3.3.dev1, then v2.3.3.dev2, v2.3.3.dev3 etc. # Also consider enabling test.pypi.org below. release: types: [published] jobs: publish: name: Publish Package runs-on: ubuntu-latest steps: - name: Install CI Tools # on my self-hosted runner, the runner image is missing these tools. run: | DEBIAN_FRONTEND=noninteractive apt update DEBIAN_FRONTEND=noninteractive apt install -y nodejs jq curl wget - uses: actions/checkout@v3 - uses: actions/setup-python@v3 - name: Install dependencies run: | pip install build - name: Build run: python -m build - name: Publish Release uses: actions/forgejo-release@v2 with: direction: upload override: true release-dir: dist/ sha256sum: true token: ${{ secrets.FORGEJO_TOKEN }} - name: Publish to PyPI if: secrets.PYPI_TOKEN != '' uses: https://github.com/pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_TOKEN }} # TESTING: # repository-url: https://test.pypi.org/legacy/ # password: ${{ secrets.TEST_PYPI_TOKEN }} ``` This published straight to https://test.pypi.org/project/radicale-bsdauth/1.0.2.dev6/ and to https://codeberg.org/kousu/radicale-bsdauth/releases/tag/v1.0.2.dev6. The next time I actually have cause to make a release it will go to https://pypi.org/project/radicale-bsdauth/1.0.2 and https://codeberg.org/kousu/radicale-bsdauth/releases/tag/v1.0.2.
Sign in to join this conversation.
No Branch/Tag specified
main
No results found.
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
8 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
actions/meta#10
Reference in a new issue
actions/meta
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?