From 3f2c6969b54c9776fa7f96d66c45db512425421e Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Fri, 16 Aug 2024 10:35:50 +0200 Subject: [PATCH 1/5] Debug why binaries workflow does not correctly describe --- .github/workflows/binaries.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/binaries.yaml b/.github/workflows/binaries.yaml index 712e4648ad4..2ab18bd7339 100644 --- a/.github/workflows/binaries.yaml +++ b/.github/workflows/binaries.yaml @@ -38,8 +38,12 @@ jobs: run: | nix build .#release-static # XXX: Why unzip https://github.com/actions/upload-artifact/issues/39 - echo "VERSION=$(git describe --always ${{ github.ref }})" >> "$GITHUB_ENV" unzip result/*.zip -d out + # FIXME: this does not correctly git describe + git describe --always ${{ github.ref }} + git fetch --tags --force + git describe --always ${{ github.ref }} + echo "VERSION=$(git describe --always ${{ github.ref }})" >> "$GITHUB_ENV" - name: 💾 Upload executables uses: actions/upload-artifact@v4 @@ -76,8 +80,9 @@ jobs: run: | nix build .#release # XXX: Why unzip https://github.com/actions/upload-artifact/issues/39 - echo "VERSION=$(git describe --always ${{ github.ref }})" >> "$GITHUB_ENV" unzip result/*.zip -d out + # FIXME: this does not correctly git describe + echo "VERSION=$(git describe --always ${{ github.ref }})" >> "$GITHUB_ENV" - name: 💾 Upload executables uses: actions/upload-artifact@v4 From 19a6f5b8ab4a5edcfadf79f104290d08e2717592 Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Fri, 16 Aug 2024 10:45:10 +0200 Subject: [PATCH 2/5] Fetch tags on checkout --- .github/workflows/binaries.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/binaries.yaml b/.github/workflows/binaries.yaml index 2ab18bd7339..2be62fd08fe 100644 --- a/.github/workflows/binaries.yaml +++ b/.github/workflows/binaries.yaml @@ -20,6 +20,7 @@ jobs: with: # Also ensure we have all history with all tags fetch-depth: 0 + fetch-tags: true - name: ❄ Prepare nix uses: cachix/install-nix-action@V27 @@ -62,6 +63,7 @@ jobs: with: # Also ensure we have all history with all tags fetch-depth: 0 + fetch-tags: true - name: ❄ Prepare nix uses: cachix/install-nix-action@V27 From aeebc34979100d2ded3210dfeb5fb51645d5e724 Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Fri, 16 Aug 2024 10:45:38 +0200 Subject: [PATCH 3/5] Only run binaries workflow on tags, some branches and PRs --- .github/workflows/binaries.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/binaries.yaml b/.github/workflows/binaries.yaml index 2be62fd08fe..23e06981b45 100644 --- a/.github/workflows/binaries.yaml +++ b/.github/workflows/binaries.yaml @@ -4,9 +4,11 @@ name: Binaries on: push: branches: - - "**" + - main + - release tags: - "*.*.*" + pull_request: jobs: # Produces static ELF binary for using MuslC which includes all needed From ed971381c2fcb2a31b992183cf534908c2803b69 Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Fri, 16 Aug 2024 10:51:28 +0200 Subject: [PATCH 4/5] Refetch tags to fix issue with git describe --- .github/workflows/binaries.yaml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/binaries.yaml b/.github/workflows/binaries.yaml index 23e06981b45..72cb3b4c727 100644 --- a/.github/workflows/binaries.yaml +++ b/.github/workflows/binaries.yaml @@ -37,16 +37,18 @@ jobs: name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' + - name: 🕵 Determine version + run: | + # NOTE: For some reason the fetched tags on checkout are not effective + # and we need to refetch with --force for git describe. + git fetch --tags --force + echo "VERSION=$(git describe --always ${{ github.ref }})" >> "$GITHUB_ENV" + - name: ❄ Build static executables run: | nix build .#release-static # XXX: Why unzip https://github.com/actions/upload-artifact/issues/39 unzip result/*.zip -d out - # FIXME: this does not correctly git describe - git describe --always ${{ github.ref }} - git fetch --tags --force - git describe --always ${{ github.ref }} - echo "VERSION=$(git describe --always ${{ github.ref }})" >> "$GITHUB_ENV" - name: 💾 Upload executables uses: actions/upload-artifact@v4 @@ -80,13 +82,18 @@ jobs: name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' + - name: 🕵 Determine version + run: | + # NOTE: For some reason the fetched tags on checkout are not effective + # and we need to refetch with --force for git describe. + git fetch --tags --force + echo "VERSION=$(git describe --always ${{ github.ref }})" >> "$GITHUB_ENV" + - name: ❄ Build executables run: | nix build .#release # XXX: Why unzip https://github.com/actions/upload-artifact/issues/39 unzip result/*.zip -d out - # FIXME: this does not correctly git describe - echo "VERSION=$(git describe --always ${{ github.ref }})" >> "$GITHUB_ENV" - name: 💾 Upload executables uses: actions/upload-artifact@v4 From f5e2a675a631cda513051fd95a0eaae698b7b27a Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Fri, 16 Aug 2024 11:14:36 +0200 Subject: [PATCH 5/5] Drop fetch-tags in checkout as it does not help --- .github/workflows/binaries.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/binaries.yaml b/.github/workflows/binaries.yaml index 72cb3b4c727..6775be54a40 100644 --- a/.github/workflows/binaries.yaml +++ b/.github/workflows/binaries.yaml @@ -22,7 +22,6 @@ jobs: with: # Also ensure we have all history with all tags fetch-depth: 0 - fetch-tags: true - name: ❄ Prepare nix uses: cachix/install-nix-action@V27 @@ -67,7 +66,6 @@ jobs: with: # Also ensure we have all history with all tags fetch-depth: 0 - fetch-tags: true - name: ❄ Prepare nix uses: cachix/install-nix-action@V27