Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): clean changelog/Workflow #1920

Merged
merged 13 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions .github/changelogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,15 @@

### How to rebase
For current users, type the following to rebase to this version:
#### For this branch (if latest):
##### Bluefin
```bash
sudo bootc switch ghcr.io/ublue-os/bluefin:{target} --enforce-container-sigpolicy
```
##### Aurora
```bash
sudo bootc switch ghcr.io/ublue-os/aurora:{target} --enforce-container-sigpolicy
```
#### For this specific image:
##### Bluefin
```bash
sudo bootc switch ghcr.io/ublue-os/bluefin:{curr} --enforce-container-sigpolicy
```
##### Aurora
```bash
sudo bootc switch ghcr.io/ublue-os/aurora:{curr} --enforce-container-sigpolicy
# Get Image Name
IMAGE_NAME=$(jq -r '.["image-name"]' < /usr/share/ublue-os/image-info.json)

# For this Stream
sudo bootc switch --enforce-container-sigpolicy ghcr.io/ublue-os/$IMAGE_NAME:{target}

# For this Specific Image:
sudo bootc switch --enforce-container-sigpolicy ghcr.io/ublue-os/$IMAGE_NAME:{curr}
```

### Documentation
Expand Down Expand Up @@ -222,7 +214,6 @@ def get_package_groups(target: str, prev: dict[str, Any], manifests: dict[str, A

# Find other packages
for t, other in others.items():
print(t)
first = True
for img, experience, de, image_flavor in get_images(target):
if img not in pkg:
Expand Down Expand Up @@ -330,6 +321,8 @@ def get_commits(prev_manifests, manifests, workdir: str):

if subject.lower().startswith("merge"):
continue
if subject.lower().startswith("chore"):
continue

out += (
COMMIT_FORMAT.replace("{short}", short)
Expand Down Expand Up @@ -382,10 +375,13 @@ def generate_changelog(
curr_pretty = re.sub(r"\.\d{1,2}$", "", curr)
# Remove target- from curr
curr_pretty = re.sub(rf"^[a-z]+-|^[0-9]+-", "", curr_pretty)
if not fedora_version + "." in curr_pretty:
curr_pretty=fedora_version + "." + curr_pretty
pretty = target.capitalize()
pretty += " (F" + fedora_version
pretty += "." + curr_pretty
pretty += ", #" + finish[:7] + ")"
pretty += " (F" + curr_pretty
if finish:
pretty += ", #" + finish[:7]
pretty += ")"

title = CHANGELOG_TITLE.format_map(defaultdict(str, tag=curr, pretty=pretty))

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-image-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
secrets: inherit
uses: ./.github/workflows/generate-release.yml
with:
stream_name: '["stable"]'
stream_name: '["stable", "stable-daily"]'

build-iso-stable:
name: Build Stable ISOs
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/generate-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ on:
inputs:
make_latest:
description: "Make latest for Release"
type: boolean
default: false
type: string
default: 'False'
stream_name:
description: "Release Tag (e.g. gts, stable)"
type: string
Expand All @@ -16,21 +16,23 @@ on:
make_latest:
description: "Make latest for Release"
type: choice
default: "false"
default: 'False'
options:
- "false"
- "true"
- 'False'
- 'True'
stream_name:
description: "Release Tag (e.g. gts, stable)"
required: true
type: choice
options:
- '["gts", "stable"]'
- '["gts"]'
- '["stable"]'
- '["stable-daily"]'
- '["latest"]'
- '["beta"]'
- '["gts", "stable"]'
- '["gts", "stable", "latest", "beta"]'
- '["stable-daily", "latest", "beta"]'
- '["gts", "stable", "stable-daily", "latest", "beta"]'

permissions:
contents: write
Expand Down Expand Up @@ -76,10 +78,10 @@ jobs:

- name: Create Release
uses: softprops/action-gh-release@v2
if: contains(fromJson('["workflow_dispatch", "workflow_call"]'), github.event_name) || contains(fromJson('["45 5 * * 0", "40 4 * * 0"]'), github.event_name.schedule)
if: contains(fromJson('["gts", "stable"]'), matrix.version) && github.event_name.schedule == '45 5 * * 0' || contains(fromJson('["workflow_dispatch", "workflow_call"]'), github.event_name)
with:
name: ${{ steps.generate-release-text.outputs.title }}
tag_name: ${{ steps.generate-release-text.outputs.tag }}
body_path: ./changelog.md
make_latest: ${{ inputs.make_latest == true && matrix.version == 'stable' || false }}
prerelease: ${{ inputs.make_latest != false }}
make_latest: ${{ inputs.make_latest == 'True' && matrix.version == 'stable' || false }}
prerelease: ${{ inputs.make_latest != 'True' }}
71 changes: 41 additions & 30 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,15 @@ jobs:
IMAGE_NAME="$(just image_name ${{ matrix.base_name }} ${{ matrix.stream_name }} ${{ matrix.image_flavor }})"
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV

- name: Generate tags
id: generate-tags
- name: Default Tag
shell: bash
run: |
DEFAULT_TAG="$(just generate-default-tag \
${{ matrix.stream_name }} \
"1")"

alias_tags="$(just generate-build-tags \
${{ matrix.base_name }} \
${{ matrix.stream_name }} \
${{ matrix.image_flavor }} \
"1" \
${{ github.event.number }} \
${{ github.event_name }})"

${{ matrix.stream_name }} \
"1")"
echo "Default Tag: ${DEFAULT_TAG}"
echo "Tags for this Action..."
echo "$alias_tags"

echo "DEFAULT_TAG=${DEFAULT_TAG}" >> $GITHUB_ENV
echo "alias_tags=${alias_tags}" >> $GITHUB_OUTPUT


- name: Maximize build space
uses: ublue-os/remove-unwanted-software@517622d6452028f266b7ba4cc9a123b5f58a6b53 # v7
with:
Expand All @@ -113,22 +99,47 @@ jobs:
"${{ matrix.image_flavor }}" \
"1"

- name: Load Image into Podman
id: load-rechunk
shell: bash
run: |
just load-rechunk "${{ matrix.base_name }}" \
"${{ env.DEFAULT_TAG }}" \
"${{ matrix.image_flavor }}"

- name: Secureboot Check
id: secureboot
shell: bash
run: |
sudo just secureboot "${{ matrix.base_name }}" \
"${{ env.DEFAULT_TAG }}" \
"${{ matrix.image_flavor }}"
just secureboot "${{ matrix.base_name }}" \
"${{ env.DEFAULT_TAG }}" \
"${{ matrix.image_flavor }}"

- name: Generate tags
id: generate-tags
shell: bash
run: |
alias_tags="$(just generate-build-tags \
${{ matrix.base_name }} \
${{ matrix.stream_name }} \
${{ matrix.image_flavor }} \
"1" \
${{ github.event.number }} \
${{ github.event_name }} \
$(podman inspect ${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }} | jq -r '.[].Config.Labels["org.opencontainers.image.version"]'))"

echo "Tags for this Action..."
echo "$alias_tags"
echo "alias_tags=${alias_tags}" >> $GITHUB_OUTPUT

# Tag Images
- name: Tag Images
shell: bash
run: |
set -eoux pipefail
sudo just tag-images "${{ env.IMAGE_NAME }}" \
"${{ env.DEFAULT_TAG }}" \
"${{ steps.generate-tags.outputs.alias_tags }}"
just tag-images "${{ env.IMAGE_NAME }}" \
"${{ env.DEFAULT_TAG }}" \
"${{ steps.generate-tags.outputs.alias_tags }}"

# Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR.
# https://github.com/macbre/push-to-ghcr/issues/12
Expand All @@ -141,7 +152,7 @@ jobs:
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
run: |
echo ${{ secrets.GITHUB_TOKEN }} | sudo podman login ghcr.io -u ${{ github.actor }} --password-stdin
echo ${{ secrets.GITHUB_TOKEN }} | podman login ghcr.io -u ${{ github.actor }} --password-stdin
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push to GHCR
Expand All @@ -155,7 +166,7 @@ jobs:
set -euox pipefail

for tag in ${{ steps.generate-tags.outputs.alias_tags }}; do
sudo podman push ${{ env.IMAGE_NAME }}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${tag}
podman push ${{ env.IMAGE_NAME }}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${tag}
done

if [[ "${{ matrix.image_flavor }}" =~ hwe ]]; then
Expand All @@ -165,12 +176,12 @@ jobs:
surface_name="${image_name/hwe/surface}"

for tag in ${{ steps.generate-tags.outputs.alias_tags }}; do
sudo podman push ${asus_name}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${asus_name}:${tag}
sudo podman push ${surface_name}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${surface_name}:${tag}
podman push ${asus_name}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${asus_name}:${tag}
podman push ${surface_name}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${surface_name}:${tag}
done
fi

digest=$(sudo skopeo inspect docker://${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }} --format '{{.Digest}}')
digest=$(skopeo inspect docker://${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }} --format '{{.Digest}}')

echo "digest=${digest}" >> $GITHUB_OUTPUT

Expand All @@ -184,7 +195,7 @@ jobs:
COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }}

- name: Sign container image
if: github.event_name != 'pull_request' && contains(inputs.image_flavors, 'hwe')
if: github.event_name != 'pull_request' && contains(matrix.image_flavor, 'hwe')
shell: bash
run: |
image_name="${{ env.IMAGE_NAME }}"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ flatpak.*
previous.manifest.json
changelog.md
output.env
version.txt
Loading
Loading