diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 3171499c1d..be14f632e8 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -35,6 +35,10 @@ jobs: with: fetch-depth: '0' + - name: Prepare docker output + run: | + touch output.env + - name: Build image id: build-image run: | @@ -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 @@ -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 @@ -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 @@ -113,4 +127,4 @@ jobs: uses: Gamesight/slack-workflow-status@master with: repo_token: ${{ secrets.GITHUB_TOKEN }} - slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file + slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/build-docker.sh b/build-docker.sh index f9b00c6165..df9c42929b 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -26,6 +26,9 @@ do c) CONFIG_FILE="${OPTARG}" ;; + v) + VOLUME="${OPTARG}" + ;; *) ;; esac @@ -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 && @@ -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 @@ -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 diff --git a/export-image/04-finalise/01-run.sh b/export-image/04-finalise/01-run.sh index b90f3b07fc..5d12f8655e 100755 --- a/export-image/04-finalise/01-run.sh +++ b/export-image/04-finalise/01-run.sh @@ -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" diff --git a/wlanpi1/01-config-files/00-run.sh b/wlanpi1/01-config-files/00-run.sh index c9e7807cfc..b04ca144f2 100755 --- a/wlanpi1/01-config-files/00-run.sh +++ b/wlanpi1/01-config-files/00-run.sh @@ -52,9 +52,9 @@ on_chroot <