Skip to content

modernize:

modernize: #72

Workflow file for this run

---
name: CI
on:
push:
branches: [ main ]
tags: [ '*' ]
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# see https://docs.vyos.io/en/latest/contributing/build-vyos.html
build:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
version:
- number: "1.5"
architecture: amd64
code: circinus
branch: current
docker-tag: current
container:
image: vyos/vyos-build:${{ matrix.version.docker-tag }}
volumes:
- /proc:/proc
options: --privileged --platform=linux/${{ matrix.version.architecture }}
steps:
- uses: actions/checkout@v6
# if git tag is being processed (for release) terminate execution of unnessesary workflows
- name: "If executed for release: Terminate unnessesary workflows"
if: ${{ startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref_name, matrix.version.number) }}
run: echo "skip=1" >>$GITHUB_ENV
# TODO check if working...
- name: Generate Version
if: ${{ !env.skip }}
run: |
if [ ${{ startsWith(github.ref, 'refs/tags/') }} == 'true' ]; then
echo "matrix.version.number=${{ github.ref_name }}" >>$GITHUB_ENV
else
echo "matrix.version.number=${{ matrix.version.number }}-dev-$(echo ${{ github.sha }} | cut -c 1-8)" >>$GITHUB_ENV
fi
#- name: Executing scripts
# if: ${{ !env.skip }}
# run: find scripts/${{ matrix.version.code }}/ -type f -name '*.sh' -exec bash {} \;
- name: Clone Repository
if: ${{ !env.skip }}
run: git clone -b ${{ matrix.version.branch }} --single-branch --depth 1 https://github.com/vyos/vyos-build.git
# Packages from VyOS 1.3 can't directly be used on VyOS >= 1.4,
# because the vyos config.py has to be adjusted (vyos.utils no longer exists)
# e. g. https://github.com/pkgs-hub/vyatta-node_exporter/blob/main/deb/opt/vyatta-node_exporter/config.py#L9
#- name: Prepare custom packages
# if: ${{ !env.skip }}
# run: |
# for deb in $(cat packages.txt); do
# mv ${deb} vyos-build/packages/
# done
- name: Configure and build ISO
if: ${{ !env.skip && contains(fromJson('["circinus"]'), matrix.version.code) }}
working-directory: vyos-build
run: ./build-vyos-image --architecture ${{ matrix.version.architecture }} --build-by "https://github.com/os-builds" generic
- name: Define filename
if: ${{ !env.skip }}
run: |
echo "filename=vyos-${{ matrix.version.number }}-${{ matrix.version.architecture }}" >>$GITHUB_ENV
- name: Rename ISO
if: ${{ !env.skip }}
run: mv vyos-build/build/live-image-${{ matrix.version.architecture }}.hybrid.iso ${{ env.filename }}.iso
- name: Upload ISO
if: ${{ !env.skip }}
uses: actions/upload-artifact@v6
with:
name: ${{ env.filename }}
path: ${{ env.filename }}.iso
- name: Checksums
if: ${{ !env.skip }}
id: checksums
run: |
echo "md5sum=$(md5sum ${{ env.filename }}.iso | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
echo "sha256sum=$(sha256sum ${{ env.filename }}.iso | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
echo "sha512sum=$(sha512sum ${{ env.filename }}.iso | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
- name: "Append iso file and calculated checksums to created release"
uses: crazy-max/ghaction-github-release@v2
if: ${{ !env.skip && startsWith(github.ref, 'refs/tags/') }}
with:
files: ${{ env.filename }}.iso
body: |
| Digest | Checksum |
|--------|----------|
| md5 | `${{ steps.checksums.outputs.md5sum }}` |
| sha256 | `${{ steps.checksums.outputs.sha256sum }}` |
| sha512 | `${{ steps.checksums.outputs.sha512sum }}` |
append_body: true
docker:
runs-on: ubuntu-latest
needs: [ build ]
permissions:
packages: write
strategy:
matrix:
version:
- number: "1.5"
architecture: amd64
code: circinus
branch: current
docker-tag: current
steps:
# if git tag is being processed (for release) terminate execution of unnessesary workflows
- name: "If executed for release: Terminate unnessesary workflows"
if: ${{ startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref_name, matrix.version.number) }}
run: echo "skip=1" >>$GITHUB_ENV
- name: Define filename
if: ${{ !env.skip }}
run: |
echo "filename=vyos-${{ matrix.version.number }}-${{ matrix.version.architecture }}" >>$GITHUB_ENV
- name: Download a single artifact
if: ${{ !env.skip }}
uses: actions/download-artifact@v7
with:
name: ${{ env.filename }}
- name: Convert ISO to OCI Image
if: ${{ !env.skip }}
run: |
mkdir rootfs
sudo mount -o loop ${{ env.filename }}.iso rootfs
sudo apt-get install -y squashfs-tools
mkdir unsquashfs
sudo unsquashfs -f -d unsquashfs/ rootfs/live/filesystem.squashfs
sudo tar -C unsquashfs -c . | docker import - ghcr.io/${{ github.repository_owner }}/vyos:${{ matrix.version.number }}
- name: Login to GitHub Container Registry
if: ${{ !env.skip && startsWith(github.ref, 'refs/tags/') }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Push image
if: ${{ !env.skip && startsWith(github.ref, 'refs/tags/') }}
run: docker push ghcr.io/${{ github.repository_owner }}/vyos:${{ matrix.version.number }}