From 910fde270b3313fc29fda34922966c60d14940df Mon Sep 17 00:00:00 2001 From: Anders da Silva Rytter Hansen Date: Tue, 5 May 2026 16:52:56 -0300 Subject: [PATCH] Adjust code for migration --- .forgejo/workflows/os.yml | 70 ++++++++++++++++++++++++++ .github/workflows/cleanup.yml | 21 -------- .github/workflows/os.yml | 95 ----------------------------------- Dockerfile | 3 +- 4 files changed, 71 insertions(+), 118 deletions(-) create mode 100644 .forgejo/workflows/os.yml delete mode 100644 .github/workflows/cleanup.yml delete mode 100644 .github/workflows/os.yml diff --git a/.forgejo/workflows/os.yml b/.forgejo/workflows/os.yml new file mode 100644 index 0000000..e4d6fd2 --- /dev/null +++ b/.forgejo/workflows/os.yml @@ -0,0 +1,70 @@ +name: os + +on: + schedule: + - cron: '0 5 8,18,28 * *' + push: + paths: + - 'Dockerfile' + - 'etc/**' + - 'usr/**' + - 'repo/**' + - '.forgejo/workflows/os.yml' + - 'buildinstallxfce.sh' + - 'buildinstallxfceaddons.sh' + workflow_dispatch: + +env: + REGISTRY: forge.pc-rytteren.dk + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: almalinux-10 + permissions: + contents: read + packages: write + + steps: + + - name: Get current date + id: date + run: echo "date=$(date +'%Y%m%d')" >> $FORGEJO_OUTPUT + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + # Vi konstruerer tags her med branch-navnet som præfiks + tags: | + type=ref,event=branch + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=${{ github.ref_name }}-10 + type=raw,value=${{ github.ref_name }}-10.${{ steps.date.outputs.date }} + + - name: Log into Forgejo Container Registry + if: github.event_name != 'pull_request' + run: | + buildah login -u ${{ github.actor }} -p ${{ secrets.PACKAGE_TOKEN }} ${{ env.REGISTRY }} + + - name: Build image with Buildah + id: build-image + run: | + # Vi bygger med 'raw-img' lokalt + buildah bud \ + --label "org.opencontainers.image.source=https://pc-rytteren.dk/forge/${{ github.repository }}" \ + -t raw-img . + + - name: Push to Forgejo Container Registry + if: github.event_name != 'pull_request' + run: | + for tag in $(echo "${{ steps.meta.outputs.tags }}"); do + echo "Tagging and pushing: $tag" + buildah tag raw-img "$tag" + buildah push "$tag" + done + diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml deleted file mode 100644 index 5337eb6..0000000 --- a/.github/workflows/cleanup.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Ryd op i GHCR - -on: - schedule: - - cron: '0 0 * * 0' # Kører hver søndag ved midnat - workflow_dispatch: # Gør det muligt at køre den manuelt - -jobs: - delete-old-images: - runs-on: ubuntu-latest - permissions: - packages: write - steps: - - name: Slet gamle versioner - uses: actions/delete-package-versions@v5 - with: - package-name: 'os-26535' # Skift til dit image navn - package-type: 'container' - min-versions-to-keep: 50 - delete-only-untagged-versions: 'false' - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/os.yml b/.github/workflows/os.yml deleted file mode 100644 index 10e0f8c..0000000 --- a/.github/workflows/os.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: os - -on: - schedule: - - cron: '0 5 8,18,28 * *' - push: - paths: - - 'Dockerfile' - - 'etc/**' - - 'usr/**' - - 'repo/**' - - '.github/workflows/os.yml' - workflow_dispatch: - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - id-token: write # Påkrævet til cosign keyless signering - - steps: - - name: Maximize build space - uses: AdityaGarg8/remove-unwanted-software@v5 - with: - remove-dotnet: 'true' - remove-android: 'true' - remove-haskell: 'true' - - - name: Get current date - id: date - run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # Vi konstruerer tags her med branch-navnet som præfiks - tags: | - type=ref,event=branch - type=raw,value=latest,enable={{is_default_branch}} - type=raw,value=${{ github.ref_name }}-10 - type=raw,value=${{ github.ref_name }}-10.${{ steps.date.outputs.date }} - - - name: Log into GHCR - if: github.event_name != 'pull_request' - run: | - buildah login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }} - - - name: Build image with Buildah - id: build-image - run: | - # Vi bygger med 'raw-img' lokalt - buildah bud \ - --label "org.opencontainers.image.source=https://github.com/${{ github.repository }}" \ - -t raw-img . - - # Gem det primære tag til signering (vi tager det første fra listen) - PRIMARY_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n 1) - echo "primary_tag=$PRIMARY_TAG" >> $GITHUB_OUTPUT - - - name: Push to GHCR - if: github.event_name != 'pull_request' - run: | - for tag in $(echo "${{ steps.meta.outputs.tags }}"); do - echo "Tagging and pushing: $tag" - buildah tag raw-img "$tag" - buildah push "$tag" - done - - - name: Install cosign - if: github.event_name != 'pull_request' - uses: sigstore/cosign-installer@v3.3.0 - - # VI TILFØJER LOGIN TIL COSIGN HER - - name: Log into GHCR (Cosign) - if: github.event_name != 'pull_request' - run: | - cosign login ${{ env.REGISTRY }} -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} - - - name: Sign image - if: github.event_name != 'pull_request' - run: | - # Vi signerer det primære tag. - # Vi bruger --yes til at acceptere betingelserne automatisk. - cosign sign --yes "${{ steps.build-image.outputs.primary_tag }}" diff --git a/Dockerfile b/Dockerfile index 9bda9d9..2d6c6c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,5 +63,4 @@ COPY usr /usr RUN cd /usr/bin && wget https://raw.githubusercontent.com/CachyOS/CachyOS-Settings/refs/heads/master/usr/bin/kerver && chmod +x kerver -RUN rm -rf /tmp/* /var/* && mkdir -p /var/tmp && chmod -R 1777 /var/tmp && \ - bootc container lint +RUN rm -rf /tmp/* /var/* && mkdir -p /var/tmp && chmod -R 1777 /var/tmp