Compare commits
1 Commits
2bbdfbecab
...
710c8593f9
| Author | SHA1 | Date | |
|---|---|---|---|
| 710c8593f9 |
@@ -3,25 +3,9 @@ name: Gentoo Utils
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
cache:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- name: Restore git cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .git
|
||||
key: gitea-repo-${{ gitea.repository }}-${{ gitea.ref }}
|
||||
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
build-oci-image:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
needs: cache
|
||||
steps:
|
||||
- name: Restore git cache
|
||||
uses: actions/cache@v4
|
||||
@@ -39,22 +23,17 @@ jobs:
|
||||
id: image-changes
|
||||
# build image only if 1. changes are detected or 2. an image for the working branch doesnt exist
|
||||
run: |
|
||||
git --no-pager log --oneline -n 10
|
||||
echo "BEFORE = ${{ gitea.event.before }}"
|
||||
branch_name="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
|
||||
default_branch_name="${{ gitea.event.repository.default_branch }}"
|
||||
image_tag=latest
|
||||
comparison_hash="${{ gitea.event.before }}"
|
||||
|
||||
git --no-pager reflog
|
||||
if [[ "$branch_name" != "${{ gitea.event.repository.default_branch }}" ]]; then
|
||||
image_tag=$branch_name
|
||||
fi
|
||||
# slugify
|
||||
image_tag="$(echo "$image_tag" | sed -E 's/[^a-zA-Z0-9]/-/g')"
|
||||
|
||||
|
||||
|
||||
# rebase breaks gitea.event.before, so check to make sure the hash provided exists
|
||||
if ! git merge-base --is-ancestor $comparison_hash $branch_name >/dev/null 2>&1; then
|
||||
comparison_hash=$(git merge-base origin/$default_branch_name $branch_name)
|
||||
@@ -95,6 +74,8 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ steps.image-changes.outputs.image_tag }}
|
||||
context: "{{defaultContext}}:.docker"
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
outputs:
|
||||
image_tag: ${{ steps.image-changes.outputs.image_tag }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user