From ab81c045692bac0b443fd00972ade61debed7e1f Mon Sep 17 00:00:00 2001 From: Alexander Mnich <56564725+a-mnich@users.noreply.github.com> Date: Sat, 30 Aug 2025 21:49:49 +0200 Subject: [PATCH] [Fix] fix GitHub workflow errors in forks (#1113) * feat: do not run winget/homebrew/scoop release in fork * fix: replaced deprecated goreleaser fields https://goreleaser.com/deprecations/#archivesbuilds * fix: push docker images only with access to the registry --- .github/workflows/docker-images.yml | 6 ++++-- .github/workflows/release.yml | 1 + beszel/.goreleaser.yml | 11 ++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index f45ab88..46885c8 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -93,7 +93,9 @@ jobs: # https://github.com/docker/login-action - name: Login to Docker Hub - if: github.event_name != 'pull_request' + env: + password_secret_exists: ${{ secrets[matrix.password_secret] != '' && 'true' || 'false' }} + if: github.event_name != 'pull_request' && env.password_secret_exists == 'true' uses: docker/login-action@v3 with: username: ${{ matrix.username || secrets[matrix.username_secret] }} @@ -108,6 +110,6 @@ jobs: context: "${{ matrix.context }}" file: ${{ matrix.dockerfile }} platforms: ${{ matrix.platforms || 'linux/amd64,linux/arm64,linux/arm/v7' }} - push: ${{ github.ref_type == 'tag' }} + push: ${{ github.ref_type == 'tag' && secrets[matrix.password_secret] != '' }} tags: ${{ steps.metadata.outputs.tags }} labels: ${{ steps.metadata.outputs.labels }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 49941ef..2363f4b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,3 +51,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.TOKEN || secrets.GITHUB_TOKEN }} WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }} + IS_FORK: ${{ github.repository_owner != 'henrygd' }} diff --git a/beszel/.goreleaser.yml b/beszel/.goreleaser.yml index 77903ca..a9a7582 100644 --- a/beszel/.goreleaser.yml +++ b/beszel/.goreleaser.yml @@ -54,7 +54,7 @@ builds: archives: - id: beszel-agent formats: [tar.gz] - builds: + ids: - beszel-agent name_template: >- {{ .Binary }}_ @@ -66,7 +66,7 @@ archives: - id: beszel formats: [tar.gz] - builds: + ids: - beszel name_template: >- {{ .Binary }}_ @@ -85,7 +85,7 @@ nfpms: API access. maintainer: henrygd section: net - builds: + ids: - beszel-agent formats: - deb @@ -122,6 +122,7 @@ scoops: homepage: "https://beszel.dev" description: "Agent for Beszel, a lightweight server monitoring platform." license: MIT + skip_upload: "{{ if .Env.IS_FORK }}true{{ else }}auto{{ end }}" # # Needs choco installed, so doesn't build on linux / default gh workflow :( # chocolateys: @@ -155,7 +156,7 @@ brews: homepage: "https://beszel.dev" description: "Agent for Beszel, a lightweight server monitoring platform." license: MIT - skip_upload: auto + skip_upload: "{{ if .Env.IS_FORK }}true{{ else }}auto{{ end }}" extra_install: | (bin/"beszel-agent-launcher").write <<~EOS #!/bin/bash @@ -187,7 +188,7 @@ winget: release_notes_url: "https://github.com/henrygd/beszel/releases/tag/v{{ .Version }}" publisher_support_url: "https://github.com/henrygd/beszel/issues" short_description: "Agent for Beszel, a lightweight server monitoring platform." - skip_upload: auto + skip_upload: "{{ if .Env.IS_FORK }}true{{ else }}auto{{ end }}" description: | Beszel is a lightweight server monitoring platform that includes Docker statistics, historical data, and alert functions. It has a friendly web