diff --git a/.github/actions/build-deb/action.yaml b/.github/actions/build-deb/action.yaml index 9cebee55..b619199f 100644 --- a/.github/actions/build-deb/action.yaml +++ b/.github/actions/build-deb/action.yaml @@ -8,6 +8,10 @@ inputs: okd-version-tag: description: OKD version tag from https://quay.io/repository/okd/scos-release?tab=tags required: true + build-rpms: + description: Build MicroShift RPM packages + required: false + default: true runs: using: "composite" @@ -20,10 +24,14 @@ runs: if: always() uses: ./.github/actions/debug-info + # Only prepare the build and run environment if the RPM packages are built. + # If RPM packages were built elsewhere, the environment is already prepared. - name: Prepare the build and run environment + if: ${{ inputs.build-rpms == 'true' }} uses: ./.github/actions/prebuild - name: Build MicroShift RPMs + if: ${{ inputs.build-rpms == 'true' }} shell: bash run: | # See https://github.com/microshift-io/microshift/blob/main/docs/build.md diff --git a/.github/workflows/release.md b/.github/workflows/release.md index b8e656ce..6ea24210 100644 --- a/.github/workflows/release.md +++ b/.github/workflows/release.md @@ -1,6 +1,6 @@ ### Install and Run -#### RPM +#### RPM and DEB Review the instructions in [MicroShift Host Deployment](https://github.com/microshift-io/microshift/blob/main/docs/run.md) to install the packages and run MicroShift. diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e923a459..0a75666f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,5 +1,8 @@ -name: release-rpms-and-images -# Workflow to build and release MicroShift RPMs and container images +name: release-packages-and-images +# Workflow to build and release the following MicroShift artifacts: +# - RPM packages +# - DEB packages +# - Bootc container images on: workflow_dispatch: @@ -18,7 +21,7 @@ on: default: all options: - all - - rpms + - packages - bootc-image jobs: @@ -57,10 +60,9 @@ jobs: image-ref: localhost/microshift-okd:latest run-clean: false - # The release process consumes the RPMs and the container image - # prepared by the build action. + # Prepare the RPM archives to be released before converting to DEB packages. - name: Prepare the RPM archives - if: contains(fromJSON('["all", "rpms"]'), inputs.build) + if: contains(fromJSON('["all", "packages"]'), inputs.build) shell: bash run : | # Archive sources separately from the RPMs @@ -71,13 +73,31 @@ jobs: cd /mnt/rpms sudo tar zcvf /mnt/release/microshift-rpms-$(uname -m).tgz . - - name: Release RPMs - if: contains(fromJSON('["all", "rpms"]'), inputs.build) + # This step is run after the RPM archives are prepared to avoid + # including DEB packages in the RPM archive. + - name: Convert the RPMs to DEB packages + if: contains(fromJSON('["all", "packages"]'), inputs.build) + uses: ./.github/actions/build-deb + with: + ushift-branch: ${{ inputs.ushift-branch }} + okd-version-tag: ${{ inputs.okd-version-tag != 'latest' && inputs.okd-version-tag || steps.detect-okd-version.outputs.okd-version-tag }} + build-rpms: false + + - name: Prepare the DEB archives + if: contains(fromJSON('["all", "packages"]'), inputs.build) + shell: bash + run: | + cd /mnt/rpms/deb + sudo tar zcvf /mnt/release/microshift-debs-$(uname -m).tgz . + + - name: Release RPM and DEB packages + if: contains(fromJSON('["all", "packages"]'), inputs.build) uses: softprops/action-gh-release@v2 with: tag_name: ${{ inputs.ushift-branch }}-${{ inputs.okd-version-tag != 'latest' && inputs.okd-version-tag || steps.detect-okd-version.outputs.okd-version-tag }} files: | /mnt/release/microshift-rpms-*.tgz + /mnt/release/microshift-debs-*.tgz /mnt/release/microshift-src.tgz overwrite_files: true diff --git a/docs/workflows.md b/docs/workflows.md index 01db84d8..85abc285 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -46,9 +46,9 @@ Run [ShellCheck](https://github.com/koalaman/shellcheck) on all shell scripts an #### MicroShift -The workflow implements a build process producing MicroShift RPM packages and Bootc -container image artifacts. It is executed manually by the repository maintainers - -no scheduled runs are configured at this time. +The workflow implements a build process producing MicroShift RPM packages, DEB +packages and Bootc container image artifacts. It is executed manually by the +repository maintainers - no scheduled runs are configured at this time. The following parameters determine the MicroShift source code branch and the OKD container image dependencies used during the build process. @@ -56,7 +56,7 @@ container image dependencies used during the build process. * [OKD version tag](https://quay.io/repository/okd/scos-release?tab=tags) The following actions are supported: -* `rpms`: Build MicroShift RPM packages +* `packages`: Build MicroShift RPM and DEB packages * `bootc-image`: Build a MicroShift Bootc container image * `all`: Build all of the above diff --git a/src/deb/install.sh b/src/deb/install.sh index bf253ef0..35b35885 100755 --- a/src/deb/install.sh +++ b/src/deb/install.sh @@ -80,7 +80,7 @@ function install_debpkg() { # Install the package and its dependencies apt-get update -y -q # shellcheck disable=SC2086 - apt-get install -y -q "${debpkg}=${version}*" ${extra_packages} + apt-get install -y -q --allow-downgrades "${debpkg}=${version}*" ${extra_packages} } function install_prereqs() {