Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Commit

Permalink
fix: use ref instead of base_ref (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonN3 authored Feb 20, 2024
1 parent e772ada commit c319d0d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 46 deletions.
64 changes: 23 additions & 41 deletions .github/workflows/test_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
max-parallel: 5
Expand Down Expand Up @@ -42,8 +41,13 @@ jobs:
- image_name: lxqt
major_version: 39
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build image
uses: JasonN3/build-action@action
uses: ./
with:
image_name: ${{ matrix.image_name }}
image_variant: ${{ matrix.image_variant }}
Expand All @@ -54,33 +58,19 @@ jobs:
container_registry: ghcr.io/${{ github.repository }}
container_repo: ublue-os/main
container_ref: main
push_container: "false"

- name: Delete main packages
run: |
if [[ "${{ matrix.image_variant }}" == "main" ]]
then
image_name=${{ matrix.image_name }}
elif [[ "${{ matrix.image_variant }}" =~ "main-*" ]]
then
variant=${{ matrix.image_variant }}
image_name=${{ matrix.image_name }}-${variant:5}
else
image_name=${{ format('{0}-{1}', matrix.image_name, matrix.image_variant) }}
fi
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ github.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/user/packages/container/${{ github.event.repository.name }}/${image_name}
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

run-bluefin-build:
name: Build uBlue-OS Bluefin
continue-on-error: false
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
max-parallel: 5
Expand Down Expand Up @@ -108,6 +98,11 @@ jobs:
- image_name: lxqt
major_version: 39
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Determine AKMODS_FLAVOR
run: |
if [[ "${{ matrix.image_variant }}" =~ ^asus* ]]; then
Expand All @@ -119,7 +114,7 @@ jobs:
fi
- name: Build image
uses: JasonN3/build-action@action
uses: ./
with:
image_name: ${{ matrix.image_name }}
image_variant: ${{ matrix.image_variant }}
Expand All @@ -132,25 +127,12 @@ jobs:
container_registry: ghcr.io/${{ github.repository }}
container_repo: ublue-os/bluefin
container_ref: main

- name: Delete main packages
run: |
if [[ "${{ matrix.image_variant }}" == "main" ]]
then
image_name=${{ matrix.image_name }}
elif [[ "${{ matrix.image_variant }}" =~ "main-*" ]]
then
variant=${{ matrix.image_variant }}
image_name=${{ matrix.image_name }}-${variant:5}
else
image_name=${{ format('{0}-{1}', matrix.image_name, matrix.image_variant) }}
fi
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ github.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/users/${{ github.repository_owner }}/packages/container/${{ github.event.repository.name }}%2F${image_name}
push_container: "false"

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

check:
name: Check build successful
Expand Down
16 changes: 11 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ inputs:
#TODO: Split Containerfiles
target:
description: target to build in Containerfile
required: true
required: false
default: main
container_registry:
description: registry to store resulting container
required: false
Expand All @@ -39,6 +40,10 @@ inputs:
description: repository ref for the container image
required: false
default: ${{ github.ref }}
push_container:
description: whether to push the resulting container image
required: false
default: "true"

runs:
using: "composite"
Expand Down Expand Up @@ -86,7 +91,7 @@ runs:
shell: bash
run: |
# Run on main
if [[ ${{ github.event_name }} != 'pull_request' && ${{ github.base_ref }} == ${{ github.event.repository.default_branch }} ]]
if [[ ${{ github.event_name }} != 'pull_request' && ${{ github.ref }} == ${{ github.event.repository.default_branch }} ]]
then
BUILD_TAG="${{ inputs.version }}"
COMMIT_TAGS=()
Expand Down Expand Up @@ -187,6 +192,7 @@ runs:
# Push the image to GHCR (Image Registry)
- name: Push To GHCR
id: push
if: inputs.push_container == 'true'
env:
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
Expand All @@ -200,19 +206,19 @@ runs:

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.event_name == 'push' && github.base_ref == github.event.repository.default_branch
if: inputs.push_container == 'true' && github.event_name == 'push' && github.ref == github.event.repository.default_branch
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

# Sign container
- uses: sigstore/[email protected]
if: github.event_name == 'push' && github.base_ref == github.event.repository.default_branch
if: inputs.push_container == 'true' && github.event_name == 'push' && github.ref == github.event.repository.default_branch

- name: Sign container image
shell: bash
if: github.event_name == 'push' && github.base_ref == github.event.repository.default_branch
if: inputs.push_container == 'true' && github.event_name == 'push' && github.ref == github.event.repository.default_branch
run: |
cosign sign -y --key env://COSIGN_PRIVATE_KEY ${{ steps.registry_case.outputs.lowercase }}/${{ steps.build_image.outputs.image }}@${TAGS}
env:
Expand Down

0 comments on commit c319d0d

Please sign in to comment.