Skip to content

Commit

Permalink
chore(ci): clean changelog/Workflow
Browse files Browse the repository at this point in the history
Improve Justfile Workflow

Support multiple dated tags per day
  • Loading branch information
m2Giles committed Nov 11, 2024
1 parent e1d7cf1 commit 7130d92
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 85 deletions.
27 changes: 10 additions & 17 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 branch (if latest):
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 @@ -382,6 +373,8 @@ 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 fedora_version + "." in curr_pretty:
curr_pretty=curr_pretty[3:]
pretty = target.capitalize()
pretty += " (F" + fedora_version
pretty += "." + curr_pretty
Expand Down
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 }})" \
"$(skopeo inspect containers-storage:localhost/${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }} | jq -r '.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

0 comments on commit 7130d92

Please sign in to comment.