From 6f8ca39fa48a65ec19da30eb2870a6a28ea618e2 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 30 Apr 2023 21:14:50 +0200 Subject: [PATCH] [FORGEJO] secrets are trimmed from output, cope with it --- .forgejo/workflows/integration.yml | 1 + .forgejo/workflows/release.yml | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/integration.yml b/.forgejo/workflows/integration.yml index e7f7e34..025fc3d 100644 --- a/.forgejo/workflows/integration.yml +++ b/.forgejo/workflows/integration.yml @@ -52,3 +52,4 @@ jobs: curl -L -sS $url/root/runner/releases/download/v1.2.3/forgejo-runner-amd64 > forgejo-runner chmod +x forgejo-runner ./forgejo-runner --version | grep 1.2.3 + diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 3337b8d..693de6b 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -74,7 +74,9 @@ jobs: ${{ steps.registry.outputs.buildx-config }} - run: | - BASE64_AUTH=`echo -n "${{ steps.secrets.outputs.doer }}:${{ steps.secrets.outputs.token }}" | base64` + token="${{ steps.secrets.outputs.token }}" ; test -z "$token" && token="${{ secrets.TOKEN }}" + doer="${{ steps.secrets.outputs.doer }}" ; test -z "$doer" && doer="${{ secrets.DOER }}" + BASE64_AUTH=`echo -n "$doer:$token" | base64` mkdir -p ~/.docker echo "{\"auths\": {\"$CI_REGISTRY\": {\"auth\": \"$BASE64_AUTH\"}}}" > ~/.docker/config.json env: @@ -105,10 +107,22 @@ jobs: docker rm runner done - - uses: https://code.forgejo.org/actions/forgejo-release@v1 + - name: publish release (when TOKEN secret is NOT set) + if: ${{ secrets.TOKEN == '' }} + uses: https://code.forgejo.org/actions/forgejo-release@v1 with: direction: upload release-dir: release release-notes: "RELEASE-NOTES#${{ steps.build.outputs.tag }}" token: ${{ steps.secrets.outputs.token }} verbose: ${{ steps.verbose.outputs.value }} + + - name: publish release (when TOKEN secret is set) + if: ${{ secrets.TOKEN != '' }} + uses: https://code.forgejo.org/actions/forgejo-release@v1 + with: + direction: upload + release-dir: release + release-notes: "RELEASE-NOTES#${{ steps.build.outputs.tag }}" + token: ${{ secrets.TOKEN }} + verbose: ${{ steps.verbose.outputs.value }}