try reverting to ubuntu-latest
Some checks failed
Build and Publish / build-release (push) Failing after 1m53s
Some checks failed
Build and Publish / build-release (push) Failing after 1m53s
This commit is contained in:
@@ -1,69 +1,68 @@
|
|||||||
name: Build and Publish
|
name: Build and Publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ${{ format('{0}', replace(replace(github.server_url, 'https://', ''), 'http://', '')) }}
|
REGISTRY: ${{ format('{0}', replace(replace(github.server_url, 'https://', ''), 'http://', '')) }}
|
||||||
# Dynamically extracts just the repository name (e.g., 'my-repo' from 'owner/my-repo')
|
|
||||||
CHART_NAME: ${{ github.event.repository.name }}
|
CHART_NAME: ${{ github.event.repository.name }}
|
||||||
IMAGE_NAME: ${{ github.event.repository.name }}
|
IMAGE_NAME: ${{ github.event.repository.name }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-release:
|
build-release:
|
||||||
runs-on: nix
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout via Native Git
|
- name: Checkout repository
|
||||||
env:
|
uses: actions/checkout@v4
|
||||||
GITEA_URL: ${{ github.server_url }}
|
|
||||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
- name: Install Nix
|
||||||
REPO: ${{ github.repository }}
|
uses: cachix/install-nix-action@v26
|
||||||
SHA: ${{ github.sha }}
|
with:
|
||||||
run: |
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
STRIPPED_URL=$(nix shell nixpkgs#gnused --command echo $GITEA_URL | sed -e 's|^https://||' -e 's|^http://||')
|
extra_nix_config: |
|
||||||
echo "Cloning from: $STRIPPED_URL"
|
experimental-features = nix-command flakes
|
||||||
# Perform the clone
|
sandbox = false
|
||||||
git clone --depth 1 "https://token:${TOKEN}@${STRIPPED_URL}/${REPO}.git" .
|
|
||||||
# Checkout the specific commit
|
|
||||||
git checkout $SHA
|
|
||||||
|
|
||||||
- name: Build Docker Image via Nix Flake
|
- name: Build Docker Image via Nix Flake
|
||||||
run: |
|
run: |
|
||||||
nix build ./build/#dockerImage
|
nix build .#dockerImage --print-build-logs
|
||||||
docker load -i result
|
docker load < result
|
||||||
|
|
||||||
- name: Log in to Gitea Container Registry
|
- name: Log in to Gitea Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Tag and Push Docker Image
|
- name: Tag and Push Docker Image
|
||||||
run: |
|
run: |
|
||||||
VERSION=${{ github.run_number }}
|
VERSION=${{ github.run_number }}
|
||||||
TARGET_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
TARGET_IMAGE=${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
|
||||||
nix shell nixpkgs#docker
|
|
||||||
# Replace 'nix-built-image:latest' with your flake's internal image name
|
# Auto-detect the built image name
|
||||||
docker tag nix-built-image:latest $TARGET_IMAGE:$VERSION
|
SOURCE_IMAGE=$(docker images --format "{{.Repository}}:{{.Tag}}" | head -n 1)
|
||||||
|
|
||||||
|
docker tag $SOURCE_IMAGE $TARGET_IMAGE:$VERSION
|
||||||
|
docker tag $SOURCE_IMAGE $TARGET_IMAGE:latest
|
||||||
docker push $TARGET_IMAGE:$VERSION
|
docker push $TARGET_IMAGE:$VERSION
|
||||||
|
docker push $TARGET_IMAGE:latest
|
||||||
|
|
||||||
|
- name: Setup Helm
|
||||||
|
uses: azure/setup-helm@v4
|
||||||
|
with:
|
||||||
|
version: v3.14.0
|
||||||
|
|
||||||
- name: Package Helm Chart
|
- name: Package Helm Chart
|
||||||
run: |
|
run: |
|
||||||
VERSION=${{ github.run_number }}
|
VERSION=${{ github.run_number }}
|
||||||
|
|
||||||
nix shell nixpkgs#kubernetes-helm
|
|
||||||
# Packages the chart using the dynamically injected repo name
|
|
||||||
helm package ops/chart --version $VERSION --app-version $VERSION
|
helm package ops/chart --version $VERSION --app-version $VERSION
|
||||||
|
|
||||||
- name: Push Helm Chart to Gitea Registry
|
- name: Push Helm Chart to Gitea Registry
|
||||||
run: |
|
run: |
|
||||||
VERSION=${{ github.run_number }}
|
VERSION=${{ github.run_number }}
|
||||||
CHART_FILE=${{ env.CHART_NAME }}-${VERSION}.tgz
|
CHART_FILE=${{ env.CHART_NAME }}-${VERSION}.tgz
|
||||||
|
|
||||||
curl --user "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \
|
curl -f --user "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \
|
||||||
-X POST \
|
-X POST \
|
||||||
--upload-file ./$CHART_FILE \
|
--upload-file ./$CHART_FILE \
|
||||||
"${{ github.server_url }}/api/packages/${{ github.repository_owner }}/helm/api/charts"
|
"${{ github.server_url }}/api/packages/${{ github.repository_owner }}/helm/api/charts"
|
||||||
|
|||||||
Reference in New Issue
Block a user