Skip to content

Commit

Permalink
fixup! fixup! fixup! .github/workflows/gen-images.yml: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
classabbyamp committed Feb 16, 2024
1 parent 44d9da5 commit 1646847
Showing 1 changed file with 39 additions and 34 deletions.
73 changes: 39 additions & 34 deletions .github/workflows/gen-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ jobs:
prepare:
name: Prepare Environment
runs-on: ubuntu-latest
defaults:
run:
shell: bash
outputs:
datecode: ${{ steps.prep.outputs.datecode }}
revision: ${{ steps.prep.outputs.revision }}

defaults:
run:
shell: bash
steps:
- name: Prepare Environment
id: prep
Expand All @@ -69,24 +70,25 @@ jobs:
needs: prepare
if: ${{ inputs.live_archs != '' && inputs.live_flavors != '' }}

defaults:
run:
shell: bash
container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
options: --privileged
volumes:
- /dev:/dev
env:
PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
DATECODE: "${{ needs.prepare.outputs.datecode }}"
MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
REPO: "${{ inputs.mirror }}"

steps:
- name: Prepare container
shell: sh
run: |
# Switch to mirror
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"$REPO"'|g' /etc/xbps.d/*-repository-*.conf
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ inputs.mirror }}"'|g' /etc/xbps.d/*-repository-*.conf
# Sync and upgrade once, assume error comes from xbps update
xbps-install -Syu || xbps-install -yu xbps
# Upgrade again (in case there was a xbps update)
Expand All @@ -99,18 +101,18 @@ jobs:
- name: Build live ISOs
run: |
make live-iso-all-print live-iso-all \
SUDO= REPOSITORY="$REPO" DATECODE=$DATECODE \
SUDO= REPOSITORY="${{ inputs.mirror }}" DATECODE="${{ needs.prepare.outputs.datecode }}" \
LIVE_ARCHS="${{ inputs.live_archs }}" LIVE_FLAVORS="${{ inputs.live_flavors }}"
- name: Prepare artifacts for upload
run: |
make dist checksum DATECODE=$DATECODE
make dist checksum DATECODE="${{ needs.prepare.outputs.datecode }}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: void-live-${{ env.DATECODE }}
name: void-live-${{ needs.prepare.outputs.datecode }}
path: |
distdir-${{ env.DATECODE }}/*
distdir-*/*
if-no-files-found: error

build-rootfs:
Expand All @@ -119,24 +121,25 @@ jobs:
needs: prepare
if: ${{ inputs.rootfs != '' }}

defaults:
run:
shell: bash
container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
options: --privileged
volumes:
- /dev:/dev
env:
PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
DATECODE: "${{ needs.prepare.outputs.datecode }}"
MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
REPO: "${{ inputs.mirror }}"

steps:
- name: Prepare container
shell: sh
run: |
# Switch to mirror
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"$REPO"'|g' /etc/xbps.d/*-repository-*.conf
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ inputs.mirror }}"'|g' /etc/xbps.d/*-repository-*.conf
# Sync and upgrade once, assume error comes from xbps update
xbps-install -Syu || xbps-install -yu xbps
# Upgrade again (in case there was a xbps update)
Expand All @@ -149,18 +152,18 @@ jobs:
- name: Build ROOTFSes
run: |
make rootfs-all-print rootfs-all \
SUDO= REPOSITORY="$REPO" DATECODE=$DATECODE \
SUDO= REPOSITORY="${{ inputs.mirror }}" DATECODE="${{ needs.prepare.outputs.datecode }}" \
ARCHS="${{ inputs.rootfs }}"
- name: Prepare artifacts for upload
run: |
make dist checksum DATECODE="$DATECODE"
make dist checksum DATECODE="${{ needs.prepare.outputs.datecode }}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: void-rootfs-${{ env.DATECODE }}
name: void-rootfs-${{ needs.prepare.outputs.datecode }}
path: |
distdir-${{ env.DATECODE }}/*
distdir-*/*
if-no-files-found: error

build-platformfs:
Expand All @@ -169,24 +172,25 @@ jobs:
needs: prepare
if: ${{ inputs.platformfs != '' }}

defaults:
run:
shell: bash
container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
options: --privileged
volumes:
- /dev:/dev
env:
PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
DATECODE: "${{ needs.prepare.outputs.datecode }}"
MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
REPO: "${{ inputs.mirror }}"

steps:
- name: Prepare container
shell: sh
run: |
# Switch to mirror
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"$REPO"'|g' /etc/xbps.d/*-repository-*.conf
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ inputs.mirror }}"'|g' /etc/xbps.d/*-repository-*.conf
# Sync and upgrade once, assume error comes from xbps update
xbps-install -Syu || xbps-install -yu xbps
# Upgrade again (in case there was a xbps update)
Expand All @@ -199,19 +203,19 @@ jobs:
- name: Build PLATFORMFSes
run: |
make platformfs-all-print platformfs-all \
SUDO= REPOSITORY="$REPO" DATECODE=$DATECODE \
SUDO= REPOSITORY="${{ inputs.mirror }}" DATECODE="${{ needs.prepare.outputs.datecode }}" \
PLATFORMS="${{ inputs.platformfs }}"
- name: Prepare artifacts for upload
run: |
make dist checksum DATECODE="$DATECODE"
make dist checksum DATECODE="${{ needs.prepare.outputs.datecode }}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: void-platformfs-${{ env.DATECODE }}
name: void-platformfs-${{ needs.prepare.outputs.datecode }}
path: |
distdir-${{ env.DATECODE }}/*
!distdir-${{ env.DATECODE }}/*ROOTFS*
distdir-*/*
!distdir-*/*ROOTFS*
if-no-files-found: error

build-sbc-img:
Expand All @@ -220,24 +224,25 @@ jobs:
needs: prepare
if: ${{ inputs.sbc_imgs != '' }}

defaults:
run:
shell: bash
container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
options: --privileged
volumes:
- /dev:/dev
env:
PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
DATECODE: "${{ needs.prepare.outputs.datecode }}"
MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
REPO: "${{ inputs.mirror }}"

steps:
- name: Prepare container
shell: sh
run: |
# Switch to mirror
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"$REPO"'|g' /etc/xbps.d/*-repository-*.conf
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ inputs.mirror }}"'|g' /etc/xbps.d/*-repository-*.conf
# Sync and upgrade once, assume error comes from xbps update
xbps-install -Syu || xbps-install -yu xbps
# Upgrade again (in case there was a xbps update)
Expand All @@ -250,18 +255,18 @@ jobs:
- name: Build SBC Images
run: |
make images-all-sbc-print images-all-sbc \
SUDO= REPOSITORY="$REPO" DATECODE=$DATECODE \
SUDO= REPOSITORY="${{ inputs.mirror }}" DATECODE="${{ needs.prepare.outputs.datecode }}" \
SBC_IMGS="${{ inputs.sbc_imgs }}"
- name: Prepare artifacts for upload
run: |
make dist checksum DATECODE="$DATECODE"
make dist checksum DATECODE="${{ needs.prepare.outputs.datecode }}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: void-sbc-img-${{ env.DATECODE }}
name: void-sbc-img-${{ needs.prepare.outputs.datecode }}
path: |
distdir-${{ env.DATECODE }}/*
!distdir-${{ env.DATECODE }}/*ROOTFS*
!distdir-${{ env.DATECODE }}/*PLATFORMFS*
distdir-*/*
!distdir-*/*ROOTFS*
!distdir-*/*PLATFORMFS*
if-no-files-found: error

0 comments on commit 1646847

Please sign in to comment.