Skip to content

Commit

Permalink
Update GitHub Actions Workflow for Compatibility and Dependency Fixes (
Browse files Browse the repository at this point in the history
…#64)

* update artifact actions to v4
* install wireless-regdb_2024.10.07 since 07.04-1 is missing and 404as
* use output.env to handle output from docker in GHA
  • Loading branch information
joshschmelzle authored Nov 7, 2024
1 parent 4884e28 commit fd21a08
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 20 deletions.
34 changes: 24 additions & 10 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
with:
fetch-depth: '0'

- name: Prepare docker output
run: |
touch output.env
- name: Build image
id: build-image
run: |
Expand All @@ -48,8 +52,18 @@ jobs:
exit 0
fi
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
sudo ./build-docker.sh -v ${{ github.event.inputs.version-bump }}
sudo docker run --rm --privileged \
multiarch/qemu-user-static --reset -p yes
sudo ./build-docker.sh -v ${{ github.workspace }}/output.env:/output.env
- name: Load and export docker output
run: |
while IFS='=' read -r key value; do
echo "Processing $key with value $value"
echo "$key=$value" >> $GITHUB_ENV
done < output.env
echo "All variables from output.env have been added to GITHUB_ENV."
- name: Generate checksum
id: generate-checksum
Expand All @@ -62,32 +76,32 @@ jobs:

- name: Set nightly artifact name
id: set-nightly-artifact-name
run: echo "ARTIFACT_NAME=wlanpi-nightly-${{ steps.build-image.outputs.version }}~gha${{ env.date }}" >> $GITHUB_ENV
run: echo "ARTIFACT_NAME=wlanpi-nightly-${{ env.version }}~gha${{ env.date }}" >> $GITHUB_ENV

- name: Upload image
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: deploy/*.zip

- name: Upload zipped image checksum
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}-sha256
path: deploy/*.sha256

- name: Upload image info
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}-info
path: deploy/*.info

- name: Create pre-release from default branch
if: ${{ github.event.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
uses: "marvinpinto/action-automatic-releases@latest"
uses: "joshschmelzle/action-automatic-releases@1c60c2dcfeb5382b81099310bdb4a376dc7753a0"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ steps.build-image.outputs.version }}
automatic_release_tag: ${{ env.version }}
prerelease: true
files: |
deploy/*.zip
Expand All @@ -97,7 +111,7 @@ jobs:
- name: Upload logs
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}-buildlogs
path: deploy/*.log
Expand All @@ -113,4 +127,4 @@ jobs:
uses: Gamesight/slack-workflow-status@master
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
11 changes: 11 additions & 0 deletions build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ do
c)
CONFIG_FILE="${OPTARG}"
;;
v)
VOLUME="${OPTARG}"
;;
*)
;;
esac
Expand Down Expand Up @@ -101,6 +104,7 @@ if [ "${CONTAINER_EXISTS}" != "" ]; then
-e "LAST_VERSION=${LAST_VERSION}" \
-e "LAST_VERSION_HASH=${LAST_VERSION_HASH}" \
-e "COMMITS_FROM_LAST=${COMMITS_FROM_LAST}" \
-v $VOLUME \
--volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \
pi-gen \
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
Expand All @@ -122,6 +126,7 @@ else
-e "LAST_VERSION=${LAST_VERSION}" \
-e "LAST_VERSION_HASH=${LAST_VERSION_HASH}" \
-e "COMMITS_FROM_LAST=${COMMITS_FROM_LAST}" \
-v $VOLUME \
pi-gen \
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
# binfmt_misc is sometimes not mounted with debian bullseye image
Expand All @@ -132,6 +137,12 @@ else
wait "$!"
fi

if grep -q "version=" "$VOLUME"; then
echo "Debug: version was written to VOLUME: $(cat "$VOLUME")"
else
echo "Error: Failed to find version in VOLUME"
fi

echo "copying results from deploy/"
${DOCKER} cp "${CONTAINER_NAME}":/pi-gen/deploy .
ls -lah deploy
Expand Down
20 changes: 13 additions & 7 deletions export-image/04-finalise/01-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,22 @@ cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE"
dpkg -l --root "$ROOTFS_DIR"
} >> "$INFO_FILE"

# new_version=$(source "${SCRIPT_DIR}/update_version.sh" "${VERSION_BUMP}")
# echo "VERSION=${new_version#v}" > "${ROOTFS_DIR}/etc/wlanpi-release"
# echo "::set-output name=version::${new_version}"

echo "VERSION=${NEW_VERSION#v}" > "${ROOTFS_DIR}/etc/wlanpi-release"
echo "::set-output name=version::${NEW_VERSION}"
# echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT
# ./01-run.sh: line 92: $GITHUB_OUTPUT: ambiguous redirect

##########################################
# OLD method to bubble up version to GHA #
##########################################
# echo "::set-output name=version::${NEW_VERSION}"
# set-output has been deprecated by GH
# https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

##############################################
# UPDATED method to bubble up version to GHA #
##############################################

echo "version=${NEW_VERSION}" >> /output.env
echo "DEBUG: version in output.env is set to ${NEW_VERSION}"

mkdir -p "${DEPLOY_DIR}"

rm -f "${DEPLOY_DIR}/${ZIP_FILENAME}${IMG_SUFFIX}.zip"
Expand Down
6 changes: 3 additions & 3 deletions wlanpi1/01-config-files/00-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ on_chroot <<CHEOF
echo "denyinterfaces usb* pan*" | tee -a /etc/dhcpcd.conf
# Install wireless-regdb which supports Wi-Fi 6E
wget -O /tmp/wireless-regdb_2024.07.04-1_all.deb http://ftp.us.debian.org/debian/pool/main/w/wireless-regdb/wireless-regdb_2024.07.04-1_all.deb
dpkg -i /tmp/wireless-regdb_2024.07.04-1_all.deb
rm -f /tmp/wireless-regdb_2024.07.04-1_all.deb
wget -O /tmp/wireless-regdb_2024.10.07-1_all.deb http://ftp.us.debian.org/debian/pool/main/w/wireless-regdb/wireless-regdb_2024.10.07-1_all.deb
dpkg -i /tmp/wireless-regdb_2024.10.07-1_all.deb
rm -f /tmp/wireless-regdb_2024.10.07-1_all.deb
update-alternatives --set regulatory.db /lib/firmware/regulatory.db-upstream
# Fix sntp permission error
Expand Down

0 comments on commit fd21a08

Please sign in to comment.