chore: update workflows for porting to forgejo

This commit is contained in:
Tommy 2024-11-24 07:09:30 +01:00
parent ef8bd194fd
commit a009286418
Signed by: tommy
SSH key fingerprint: SHA256:1LWgQT3QPHIT29plS8jjXc3S1FcE/4oGvsx3Efxs6Uc

View file

@ -9,13 +9,13 @@ on:
default: latest default: latest
required: false required: false
schedule: schedule:
- cron: "0 * * * *" - cron: "0 * * * *"
concurrency: concurrency:
group: ${{ github.actor }}-build group: ${{ github.actor }}-build
env: env:
TALOS_VERSION : "${{ inputs.version || 'latest' }}" TALOS_VERSION: "${{ inputs.version || 'latest' }}"
# renovate: depName=ghcr.io/siderolabs/intel-ucode # renovate: depName=ghcr.io/siderolabs/intel-ucode
INTEL_UCODE_VERSION: 20231114 INTEL_UCODE_VERSION: 20231114
# renovate: depName=ghcr.io/siderolabs/i915-ucode # renovate: depName=ghcr.io/siderolabs/i915-ucode
@ -24,38 +24,38 @@ env:
jobs: jobs:
check-releases: check-releases:
name: Check for new releases name: Check for new releases
runs-on: ubuntu-latest runs-on: ci-os
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch Talos release version - name: Fetch Talos release version
id: talos-release id: talos-release
run: | run: |
if [ "${{ env.TALOS_VERSION }}" == "latest" ]; then if [ "${{ env.TALOS_VERSION }}" == "latest" ]; then
talos_release_tag=$(curl -sL https://api.github.com/repos/siderolabs/talos/releases/latest | jq -r ".tag_name") talos_release_tag=$(curl -sL https://api.github.com/repos/siderolabs/talos/releases/latest | jq -r ".tag_name")
else else
talos_release_tag="${{ env.TALOS_VERSION }}" talos_release_tag="${{ env.TALOS_VERSION }}"
fi fi
echo "talos_release_tag=$talos_release_tag" >> $GITHUB_OUTPUT echo "talos_release_tag=$talos_release_tag" >> $GITHUB_OUTPUT
- name: Fetch latest Boot Assets release version - name: Fetch latest Boot Assets release version
id: boot-asset-release id: boot-asset-release
run: | run: |
boot_assets_release_tag=$(curl -sL https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r ".tag_name") boot_assets_release_tag=$(curl -sL https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r ".tag_name")
echo "boot_assets_release_tag=$boot_assets_release_tag" >> $GITHUB_OUTPUT echo "boot_assets_release_tag=$boot_assets_release_tag" >> $GITHUB_OUTPUT
- name: Compare release versions - name: Compare release versions
if: steps.talos-release.outputs.talos_release_tag != steps.boot-asset-release.outputs.boot_assets_release_tag if: steps.talos-release.outputs.talos_release_tag != steps.boot-asset-release.outputs.boot_assets_release_tag
id: compare-releases id: compare-releases
run: | run: |
compare_result=$(./.github/scripts/semver2.sh \ compare_result=$(./.github/scripts/semver2.sh \
${{ steps.talos-release.outputs.talos_release_tag }} \ ${{ steps.talos-release.outputs.talos_release_tag }} \
${{ steps.boot-asset-release.outputs.boot_assets_release_tag }}) ${{ steps.boot-asset-release.outputs.boot_assets_release_tag }})
echo "compare_result=$compare_result" >> $GITHUB_OUTPUT echo "compare_result=$compare_result" >> $GITHUB_OUTPUT
outputs: outputs:
newTalosReleaseFound: ${{ steps.compare-releases.outputs.compare_result }} newTalosReleaseFound: ${{ steps.compare-releases.outputs.compare_result }}
@ -65,127 +65,127 @@ jobs:
needs: [ check-releases ] needs: [ check-releases ]
if: needs.check-releases.outputs.newTalosReleaseFound || github.event_name == 'workflow_dispatch' if: needs.check-releases.outputs.newTalosReleaseFound || github.event_name == 'workflow_dispatch'
name: Build kernel image name: Build kernel image
runs-on: ubuntu-latest runs-on: ci-os
steps: steps:
- name: Get pkgs release tag - name: Get pkgs release tag
id: pkgs-release id: pkgs-release
run: | run: |
release=release-$(grep -Eo '[0-9]\.[0-9]+' <<< '${{ needs.check-releases.outputs.talosReleaseTag }}') release=release-$(grep -Eo '[0-9]\.[0-9]+' <<< '${{ needs.check-releases.outputs.talosReleaseTag }}')
echo "release=$release" >> $GITHUB_OUTPUT echo "release=$release" >> $GITHUB_OUTPUT
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: siderolabs/pkgs repository: siderolabs/pkgs
ref: ${{ steps.pkgs-release.outputs.release }} ref: ${{ steps.pkgs-release.outputs.release }}
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 fetch-depth: 0
- name: Checkout patches - name: Checkout patches
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: ${{ github.repository }} repository: ${{ github.repository }}
ref: ${{ github.sha }} ref: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
path: patches path: patches
sparse-checkout: patches/pkgs sparse-checkout: patches/pkgs
sparse-checkout-cone-mode: false sparse-checkout-cone-mode: false
- name: Apply patches - name: Apply patches
run: | run: |
while IFS= read -r file; do while IFS= read -r file; do
echo "==> Adding $file" echo "==> Adding $file"
git apply -v $file git apply -v $file
done < <(find "./patches/patches/pkgs" -type f -name "*.patch" | sort) done < <(find "./patches/patches/pkgs" -type f -name "*.patch" | sort)
- name: Maximize build space - name: Maximize build space
uses: jlumbroso/free-disk-space@main uses: jlumbroso/free-disk-space@main
with: with:
large-packages: true large-packages: true
docker-images: true docker-images: true
swap-storage: true swap-storage: true
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3.3.0 uses: docker/login-action@v3.3.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Build kernel image - name: Build kernel image
run: | run: |
make kernel \ make kernel \
PLATFORM=linux/amd64 \ PLATFORM=linux/amd64 \
USERNAME="${{ github.actor }}" \ USERNAME="${{ github.actor }}" \
TAG="${{ needs.check-releases.outputs.talosReleaseTag }}" \ TAG="${{ needs.check-releases.outputs.talosReleaseTag }}" \
PUSH="true" PUSH="true"
build-installer: build-installer:
needs: [ check-releases, build-kernel ] needs: [ check-releases, build-kernel ]
if: needs.check-releases.outputs.newTalosReleaseFound || github.event_name == 'workflow_dispatch' if: needs.check-releases.outputs.newTalosReleaseFound || github.event_name == 'workflow_dispatch'
name: Build installer image name: Build installer image
runs-on: ubuntu-latest runs-on: ci-os
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: siderolabs/talos repository: siderolabs/talos
ref: refs/tags/${{ needs.check-releases.outputs.talosReleaseTag }} ref: refs/tags/${{ needs.check-releases.outputs.talosReleaseTag }}
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 fetch-depth: 0
- name: Checkout patches - name: Checkout patches
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: ${{ github.repository }} repository: ${{ github.repository }}
ref: ${{ github.sha }} ref: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
path: patches path: patches
sparse-checkout: patches/talos sparse-checkout: patches/talos
sparse-checkout-cone-mode: false sparse-checkout-cone-mode: false
- name: Apply patches - name: Apply patches
run: | run: |
while IFS= read -r file; do while IFS= read -r file; do
echo "==> Adding $file" echo "==> Adding $file"
git apply -v $file git apply -v $file
done < <(find "./patches/patches/talos" -type f -name "*.patch" | sort) done < <(find "./patches/patches/talos" -type f -name "*.patch" | sort)
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3.3.0 uses: docker/login-action@v3.3.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Build installer image - name: Build installer image
run: | run: |
make installer \ make installer \
PLATFORM="linux/amd64" \ PLATFORM="linux/amd64" \
USERNAME="${{ github.actor }}" \ USERNAME="${{ github.actor }}" \
TAG="${{ needs.check-releases.outputs.talosReleaseTag }}" \ TAG="${{ needs.check-releases.outputs.talosReleaseTag }}" \
PKG_KERNEL="ghcr.io/${{ github.actor }}/kernel:${{ needs.check-releases.outputs.talosReleaseTag }}" \ PKG_KERNEL="ghcr.io/${{ github.actor }}/kernel:${{ needs.check-releases.outputs.talosReleaseTag }}" \
PUSH="true" PUSH="true"
build-boot-assets: build-boot-assets:
needs: [ check-releases, build-installer ] needs: [ check-releases, build-installer ]
if: needs.check-releases.outputs.newTalosReleaseFound || github.event_name == 'workflow_dispatch' if: needs.check-releases.outputs.newTalosReleaseFound || github.event_name == 'workflow_dispatch'
name: Build boot assets name: Build boot assets
runs-on: ubuntu-latest runs-on: ci-os
permissions: permissions:
contents: write contents: write
@ -194,81 +194,81 @@ jobs:
image: ghcr.io/${{ github.actor }}/installer:${{ needs.check-releases.outputs.talosReleaseTag }} image: ghcr.io/${{ github.actor }}/installer:${{ needs.check-releases.outputs.talosReleaseTag }}
options: --privileged options: --privileged
volumes: volumes:
- /dev:/dev - /dev:/dev
steps: steps:
- name: Build amd64 installer with I915 & Intel Ucode - name: Build amd64 installer with I915 & Intel Ucode
run: | run: |
/bin/imager installer \ /bin/imager installer \
--arch amd64 \ --arch amd64 \
--base-installer-image ghcr.io/${{ github.actor }}/installer:${{ needs.check-releases.outputs.talosReleaseTag }} \ --base-installer-image ghcr.io/${{ github.actor }}/installer:${{ needs.check-releases.outputs.talosReleaseTag }} \
--system-extension-image ghcr.io/siderolabs/i915-ucode:${{ env.I915_UCODE_VERSION }} \ --system-extension-image ghcr.io/siderolabs/i915-ucode:${{ env.I915_UCODE_VERSION }} \
--system-extension-image ghcr.io/siderolabs/intel-ucode:${{ env.INTEL_UCODE_VERSION }} --system-extension-image ghcr.io/siderolabs/intel-ucode:${{ env.INTEL_UCODE_VERSION }}
- name: Upload installer artifact - name: Upload installer artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: talos-installer name: talos-installer
path: /out/installer-amd64.tar path: /out/installer-amd64.tar
if-no-files-found: error if-no-files-found: error
retention-days: 1 retention-days: 1
push-installer-image: push-installer-image:
needs: [ check-releases, build-boot-assets ] needs: [ check-releases, build-boot-assets ]
name: Push installer image name: Push installer image
runs-on: ubuntu-latest runs-on: ci-os
permissions: permissions:
contents: read contents: read
packages: write packages: write
steps: steps:
- name: Download talos installer image - name: Download talos installer image
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: talos-installer name: talos-installer
path: /tmp/talos-build-assets path: /tmp/talos-build-assets
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3.3.0 uses: docker/login-action@v3.3.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- uses: imjasonh/setup-crane@v0.4 - uses: imjasonh/setup-crane@v0.4
- name: Push installer image - name: Push installer image
run: | run: |
crane push \ crane push \
--platform linux/amd64 \ --platform linux/amd64 \
/tmp/talos-build-assets/installer-amd64.tar \ /tmp/talos-build-assets/installer-amd64.tar \
ghcr.io/${{ github.actor }}/installer:${{ needs.check-releases.outputs.talosReleaseTag }} code.252.no/${{ github.actor }}/talos/apple-x86-installer:${{ needs.check-releases.outputs.talosReleaseTag }}
create-release: create-release:
needs: [ check-releases, push-installer-image ] needs: [ check-releases, push-installer-image ]
if: needs.check-releases.outputs.newTalosReleaseFound if: needs.check-releases.outputs.newTalosReleaseFound
name: Create a new release name: Create a new release
runs-on: ubuntu-latest runs-on: ci-os
permissions: permissions:
contents: write contents: write
steps: steps:
- name: Fetch Talos release body - name: Fetch Talos release body
id: talos-release-body id: talos-release-body
run: | run: |
echo 'talos_release_body<<EOF' >> $GITHUB_OUTPUT echo 'talos_release_body<<EOF' >> $GITHUB_OUTPUT
curl -sL https://api.github.com/repos/siderolabs/talos/releases/tags/${{ needs.check-releases.outputs.talosReleaseTag }} | jq -r ".body" >> $GITHUB_OUTPUT curl -sL https://api.github.com/repos/siderolabs/talos/releases/tags/${{ needs.check-releases.outputs.talosReleaseTag }} | jq -r ".body" >> $GITHUB_OUTPUT
echo EOF >> $GITHUB_OUTPUT echo EOF >> $GITHUB_OUTPUT
- name: Create a new release # - name: Create a new release
uses: softprops/action-gh-release@v1 # uses: softprops/action-gh-release@v1
with: # with:
tag_name: ${{ needs.check-releases.outputs.talosReleaseTag }} # tag_name: ${{ needs.check-releases.outputs.talosReleaseTag }}
body: ${{ steps.talos-release-body.outputs.talos_release_body }} # body: ${{ steps.talos-release-body.outputs.talos_release_body }}