diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f7467df..7f1fd11 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,11 +1,11 @@ name: build development package on: pull_request: - merge_group: + merge_group: push: branches: - main - workflow_dispatch: + workflow_dispatch: env: IMAGE_NAME: ublue-update IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} @@ -18,7 +18,18 @@ jobs: contents: read packages: write id-token: write - steps: + strategy: + fail-fast: false + matrix: + major_version: [38, 39] + include: + - major_version: 38 + is_latest_version: true + is_stable_version: true + - major_version: 39 + is_latest_version: true + is_stable_version: false + steps: # Checkout push-to-registry action GitHub repository - name: Checkout Push to Registry action uses: actions/checkout@v4 @@ -27,16 +38,41 @@ jobs: id: generate-tags shell: bash run: | - echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT - alias_tags=() - # Only perform the follow code when the action is spawned from a Pull Request + # Generate a timestamp for creating an image version history + TIMESTAMP="$(date +%Y%m%d)" + MAJOR_VERSION="${{ matrix.major_version }}" + COMMIT_TAGS=() + BUILD_TAGS=() + # Have tags for tracking builds during pull request + SHA_SHORT="${GITHUB_SHA::7}" + COMMIT_TAGS+=("pr-${{ github.event.pull_request.number }}-${MAJOR_VERSION}") + COMMIT_TAGS+=("${SHA_SHORT}-${MAJOR_VERSION}") + if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \ + [[ "${{ matrix.is_stable_version }}" == "true" ]]; then + COMMIT_TAGS+=("pr-${{ github.event.pull_request.number }}") + COMMIT_TAGS+=("${SHA_SHORT}") + fi + + BUILD_TAGS=("${MAJOR_VERSION}" "${MAJOR_VERSION}-${TIMESTAMP}") + + if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \ + [[ "${{ matrix.is_stable_version }}" == "true" ]]; then + BUILD_TAGS+=("latest") + fi + if [[ "${{ github.event_name }}" == "pull_request" ]]; then - alias_tags+=("pr-${{ github.event.number }}") + echo "Generated the following commit tags: " + for TAG in "${COMMIT_TAGS[@]}"; do + echo "${TAG}" + done + alias_tags=("${COMMIT_TAGS[@]}") else - # The following is run when the timer is triggered or a merge/push to main - echo "date=$(date +%Y%m%d)" >> $GITHUB_OUTPUT - alias_tags+=("latest") + alias_tags=("${BUILD_TAGS[@]}") fi + echo "Generated the following build tags: " + for TAG in "${BUILD_TAGS[@]}"; do + echo "${TAG}" + done echo "alias_tags=${alias_tags[*]}" >> $GITHUB_OUTPUT # Build image using Buildah action @@ -49,8 +85,8 @@ jobs: image: ${{ env.IMAGE_NAME }} tags: | ${{ steps.generate-tags.outputs.alias_tags }} - ${{ steps.generate-tags.outputs.date }} - ${{ steps.generate-tags.outputs.sha_short }} + build-args: | + FEDORA_MAJOR_VERSION=${{ matrix.major_version }} oci: true # Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR. @@ -103,7 +139,7 @@ jobs: if: github.event_name != 'pull_request' run: | echo "${{ toJSON(steps.push.outputs) }}" - + copr-build: permissions: contents: read diff --git a/CHANGELOG.md b/CHANGELOG.md index 76cb050..c1e0add 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [1.3.0](https://github.com/ublue-os/ublue-update/compare/v1.2.2...v1.3.0) (2023-09-20) + + +### Features + +* **ci:** Split build for Fedora 38 and 39 ([#67](https://github.com/ublue-os/ublue-update/issues/67)) ([bd27a84](https://github.com/ublue-os/ublue-update/commit/bd27a84414aa917dbf4940defa062d9886164972)) + +## [1.2.2](https://github.com/ublue-os/ublue-update/compare/v1.2.1...v1.2.2) (2023-09-17) + + +### Bug Fixes + +* change default max_mem_percent to 90.0 ([6119d3b](https://github.com/ublue-os/ublue-update/commit/6119d3b162ee72a28698ff501f7c7b6ead9c3594)) +* formatting and errors ([53da743](https://github.com/ublue-os/ublue-update/commit/53da7431e5c4268519809c0d69bd4f1dd30a7aca)) +* **hardware.py:** fixed memory check ([3f9aaec](https://github.com/ublue-os/ublue-update/commit/3f9aaec05fd04183f3eacdf1fef1b3260522c055)) +* remove typo in arguments for notify-send ([41e3ed9](https://github.com/ublue-os/ublue-update/commit/41e3ed90b919891d98fd4a6b86a0bc3c04aa1831)) +* remove typo in arguments for notify-send ([#61](https://github.com/ublue-os/ublue-update/issues/61)) ([0b0edf0](https://github.com/ublue-os/ublue-update/commit/0b0edf048a02a5a15ab9fb9c909383818dd2146e)) +* skip copr-build on PRs ([9d1b30a](https://github.com/ublue-os/ublue-update/commit/9d1b30aecc9eb815eb34205f6a2128bd77f7ed37)) + ## [1.2.1](https://github.com/ublue-os/ublue-update/compare/v1.2.0...v1.2.1) (2023-09-04) diff --git a/Containerfile b/Containerfile index 1c46466..d5af966 100644 --- a/Containerfile +++ b/Containerfile @@ -1,4 +1,6 @@ -FROM registry.fedoraproject.org/fedora:latest AS builder +ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-39}" + +FROM registry.fedoraproject.org/fedora:${FEDORA_MAJOR_VERSION} AS builder ENV UBLUE_ROOT=/app/output