From 0929185d0490b6556b79df8be22fed698054cf5a Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 14:40:05 +0000 Subject: [PATCH 01/26] Fix tagtype logic, shell quotes need to be correct for shell vars --- .github/workflows/tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d082e3b..84e4692 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -498,7 +498,9 @@ jobs: steps: - name: Get Tag Type run: | - echo '::set-output name=TAGTYPE::$(git cat-file -t $GITHUB_REF)' + TAGTYPE=$(git cat-file -t $GITHUB_REF) + echo TAGTYPE=$TAGTYPE + echo "::set-output name=TAGTYPE::$TAGTYPE" - name: Fetch all Artifacts if: steps.get_tagtype.outputs.TAGTYPE == 'tag' From 78889f8d9892a9fb7bc19bd087f8c9ef5ce39768 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 14:50:50 +0000 Subject: [PATCH 02/26] Fix - if we want to run git commands, we need a git repo clone --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 84e4692..8339d5a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -496,6 +496,8 @@ jobs: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v2 + - name: Get Tag Type run: | TAGTYPE=$(git cat-file -t $GITHUB_REF) From 5538a550902f7ac1a250c781af55e5d1c23e22a0 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 15:08:51 +0000 Subject: [PATCH 03/26] Add some debug info to the release automation --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8339d5a..566a28c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -502,6 +502,8 @@ jobs: run: | TAGTYPE=$(git cat-file -t $GITHUB_REF) echo TAGTYPE=$TAGTYPE + echo REF=$GITHUB_REF + git for-each-ref refs/tags echo "::set-output name=TAGTYPE::$TAGTYPE" - name: Fetch all Artifacts From e5b373dd105337ad28045761b0d2a7d743e4f985 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 15:11:03 +0000 Subject: [PATCH 04/26] With the better release gating, we dont need to check if the job can run (also allows more debug info output) --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 566a28c..17bc0cf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -485,7 +485,6 @@ jobs: # upload_release: name: Upload Release Assets - if: startsWith(github.ref, 'refs/tags/') needs: - package_dpkg - package_rpm From 0a24c40e25033a178a2660319d003946fade4956 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 15:33:11 +0000 Subject: [PATCH 05/26] Tags dont work properly with a thin clone --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 17bc0cf..ed6e91e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -496,6 +496,8 @@ jobs: steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Get Tag Type run: | From 3371a50d5a394d37f5b0cee4f974e73f25965b24 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 15:39:57 +0000 Subject: [PATCH 06/26] Add more debug data, still trying to work out why github doesnt think tags are tags --- .github/workflows/tests.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ed6e91e..7fca895 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -502,10 +502,19 @@ jobs: - name: Get Tag Type run: | TAGTYPE=$(git cat-file -t $GITHUB_REF) - echo TAGTYPE=$TAGTYPE + echo "::set-output name=TAGTYPE::$TAGTYPE" + echo ================Debug echo REF=$GITHUB_REF + echo TAGTYPE=$TAGTYPE + echo git for-each-ref refs/tags git for-each-ref refs/tags - echo "::set-output name=TAGTYPE::$TAGTYPE" + echo ================ + echo git for-each-ref refs/heads + git for-each-ref refs/heads + echo ================ + echo git cat-file $TAGTYPE $GITHUB_REF + git cat-file $TAGTYPE $GITHUB_REF + echo ================ - name: Fetch all Artifacts if: steps.get_tagtype.outputs.TAGTYPE == 'tag' From e63b0f3c53cdbd2b6a2d2f23478482fd72402402 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 15:59:06 +0000 Subject: [PATCH 07/26] Attempt to work around strage git behaviour in github --- .github/workflows/tests.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7fca895..b199c49 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -499,13 +499,23 @@ jobs: with: fetch-depth: 0 + # There is something strange with the github runners + # normally, `git for-each-ref refs/tags` will show annotated tags + # with a type of "tag" and lightweight with type "commit". + # But not in the github runner environment... + # So, instead of: + # TAGTYPE=$(git cat-file -t $GITHUB_REF) + # We build a workaround - name: Get Tag Type run: | - TAGTYPE=$(git cat-file -t $GITHUB_REF) + git cat-file tag $GITHUB_REF + if $? -eq 0; then TAGTYPE=tag; else TAGTYPE=commit; fi echo "::set-output name=TAGTYPE::$TAGTYPE" + echo ================Debug echo REF=$GITHUB_REF echo TAGTYPE=$TAGTYPE + echo ================ echo git for-each-ref refs/tags git for-each-ref refs/tags echo ================ From 1adbdc9a00cdf39cc7ed386841199781af9e293c Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 16:08:12 +0000 Subject: [PATCH 08/26] Avoid exitcode triggering job failure --- .github/workflows/tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b199c49..89853b2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -508,8 +508,7 @@ jobs: # We build a workaround - name: Get Tag Type run: | - git cat-file tag $GITHUB_REF - if $? -eq 0; then TAGTYPE=tag; else TAGTYPE=commit; fi + if git cat-file tag $GITHUB_REF; then TAGTYPE=tag; else TAGTYPE=commit; fi echo "::set-output name=TAGTYPE::$TAGTYPE" echo ================Debug From 55c063513d1c323df7df201a5bdaca759e0ad44a Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 16:15:18 +0000 Subject: [PATCH 09/26] Shorten line to address yamllint warning --- .github/workflows/tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 89853b2..c1617b0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -508,12 +508,12 @@ jobs: # We build a workaround - name: Get Tag Type run: | - if git cat-file tag $GITHUB_REF; then TAGTYPE=tag; else TAGTYPE=commit; fi - echo "::set-output name=TAGTYPE::$TAGTYPE" + if git cat-file tag $GITHUB_REF; then TYPE=tag; else TYPE=commit; fi + echo "::set-output name=TAGTYPE::$TYPE" echo ================Debug echo REF=$GITHUB_REF - echo TAGTYPE=$TAGTYPE + echo TAGTYPE=$TYPE echo ================ echo git for-each-ref refs/tags git for-each-ref refs/tags @@ -521,8 +521,8 @@ jobs: echo git for-each-ref refs/heads git for-each-ref refs/heads echo ================ - echo git cat-file $TAGTYPE $GITHUB_REF - git cat-file $TAGTYPE $GITHUB_REF + echo git cat-file $TYPE $GITHUB_REF + git cat-file $TYPE $GITHUB_REF echo ================ - name: Fetch all Artifacts From 9b081805f5a97fac5dcc9f9283523883d620e76a Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 16:27:14 +0000 Subject: [PATCH 10/26] Add more tag debugging output --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c1617b0..ac4854a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -524,6 +524,9 @@ jobs: echo git cat-file $TYPE $GITHUB_REF git cat-file $TYPE $GITHUB_REF echo ================ + echo cat .git/$GITHUB_REF + cat .git/$GITHUB_REF + echo ================ - name: Fetch all Artifacts if: steps.get_tagtype.outputs.TAGTYPE == 'tag' From 71021abd9763754c440070a86b3ac5c2d81f96c8 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 16:43:05 +0000 Subject: [PATCH 11/26] Try a different way to fetch the right tag data --- .github/workflows/tests.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ac4854a..990fad4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -503,11 +503,18 @@ jobs: # normally, `git for-each-ref refs/tags` will show annotated tags # with a type of "tag" and lightweight with type "commit". # But not in the github runner environment... + # + # Additionally, it seems that if you push both a commit and an annotated + # tag at the same time, two workflow actions start (as expected), and + # the annotated tag is visible in the "commit" action, but looks like a + # lightweight tag in the "tag" action + # # So, instead of: # TAGTYPE=$(git cat-file -t $GITHUB_REF) - # We build a workaround + # We try to build a workaround - name: Get Tag Type run: | + git pull --tags if git cat-file tag $GITHUB_REF; then TYPE=tag; else TYPE=commit; fi echo "::set-output name=TAGTYPE::$TYPE" From 6395aa4fbc5c593e31684a24a40c5c28864274ed Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 16:53:49 +0000 Subject: [PATCH 12/26] Getting closer, it clearly showed the upstream had a different view than this checkout --- .github/workflows/tests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 990fad4..6508c65 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -496,8 +496,6 @@ jobs: steps: - uses: actions/checkout@v2 - with: - fetch-depth: 0 # There is something strange with the github runners # normally, `git for-each-ref refs/tags` will show annotated tags @@ -514,7 +512,7 @@ jobs: # We try to build a workaround - name: Get Tag Type run: | - git pull --tags + git pull --tags --force if git cat-file tag $GITHUB_REF; then TYPE=tag; else TYPE=commit; fi echo "::set-output name=TAGTYPE::$TYPE" From 3e2be20614b2c5b2eaed7f486c43c8e6e584a5f2 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 17:08:10 +0000 Subject: [PATCH 13/26] Try returning to the 'normal' command, after force pulling the correct repo data --- .github/workflows/tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6508c65..c5a479b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -507,13 +507,13 @@ jobs: # the annotated tag is visible in the "commit" action, but looks like a # lightweight tag in the "tag" action # - # So, instead of: - # TAGTYPE=$(git cat-file -t $GITHUB_REF) - # We try to build a workaround + # It appears that the repository that is checked out as part of a tag + # action does not have the correct tag object in it. As a work around, + # we do a force pull of the repo to get the correct tag details. - name: Get Tag Type run: | - git pull --tags --force - if git cat-file tag $GITHUB_REF; then TYPE=tag; else TYPE=commit; fi + git pull --tags --force origin HEAD + TYPE=$(git cat-file -t $GITHUB_REF) echo "::set-output name=TAGTYPE::$TYPE" echo ================Debug From 23ef8e4bfe2fd049becd53bc958804dc8906ee75 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 17:17:23 +0000 Subject: [PATCH 14/26] Adjust pull command to pull.rebase=false --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c5a479b..4935ca5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -512,7 +512,7 @@ jobs: # we do a force pull of the repo to get the correct tag details. - name: Get Tag Type run: | - git pull --tags --force origin HEAD + git pull --no-rebase --tags --force origin HEAD TYPE=$(git cat-file -t $GITHUB_REF) echo "::set-output name=TAGTYPE::$TYPE" From e709997b3c4bd4d6232d1a44469fecfc63e423d2 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 17:34:23 +0000 Subject: [PATCH 15/26] Abandon using the github checkout action, it is clearly at fault --- .github/workflows/tests.yml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4935ca5..3388577 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -495,24 +495,29 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - # There is something strange with the github runners - # normally, `git for-each-ref refs/tags` will show annotated tags + # There is something strange with the repo that you end up with + # using actions/checkout@v2. + # + # It appears that the repository that is checked out as part of a tag + # action does not have the correct tag object in it. As a work around, + # we dont use the actions/checkout@v2 + # + # Normally, `git for-each-ref refs/tags` will show annotated tags # with a type of "tag" and lightweight with type "commit". - # But not in the github runner environment... + # But not with this checkout # # Additionally, it seems that if you push both a commit and an annotated # tag at the same time, two workflow actions start (as expected), and - # the annotated tag is visible in the "commit" action, but looks like a - # lightweight tag in the "tag" action + # the two checkouts show different things: + # - the annodated tag is visible in the "commit" action + # - but it looks like a lightweight tag in the "tag" action # - # It appears that the repository that is checked out as part of a tag - # action does not have the correct tag object in it. As a work around, - # we do a force pull of the repo to get the correct tag details. + - name: Checkout + run: | + git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY $GITHUB_WORKSPACE + - name: Get Tag Type run: | - git pull --no-rebase --tags --force origin HEAD TYPE=$(git cat-file -t $GITHUB_REF) echo "::set-output name=TAGTYPE::$TYPE" From d9d524a8d8586f79f7056bfb89a1a007f26b376f Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 17:47:43 +0000 Subject: [PATCH 16/26] Add more debug data output --- .github/workflows/tests.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3388577..de82a3d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -515,9 +515,16 @@ jobs: - name: Checkout run: | git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY $GITHUB_WORKSPACE + echo git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY $GITHUB_WORKSPACE - name: Get Tag Type run: | + echo ================Debug + echo ls .git/refs/heads + ls .git/refs/heads + echo ls .git/refs/tags + ls .git/refs/tags + echo ================ TYPE=$(git cat-file -t $GITHUB_REF) echo "::set-output name=TAGTYPE::$TYPE" @@ -534,8 +541,8 @@ jobs: echo git cat-file $TYPE $GITHUB_REF git cat-file $TYPE $GITHUB_REF echo ================ - echo cat .git/$GITHUB_REF - cat .git/$GITHUB_REF + echo cat .git/$GITHUB_REF || true + cat .git/$GITHUB_REF || true echo ================ - name: Fetch all Artifacts From a4f5b18308c959041bd16e7cdcac6059a12293a9 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 18:14:40 +0000 Subject: [PATCH 17/26] Of course, nobody has a standard git repo layout, so need to jump more hoops --- .github/workflows/tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index de82a3d..1fd2f59 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -514,8 +514,9 @@ jobs: # - name: Checkout run: | - git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY $GITHUB_WORKSPACE - echo git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY $GITHUB_WORKSPACE + git init . + git remote add origin GITHUB_SERVER_URL/$GITHUB_REPOSITORY + git fetch --tags origin +$GITHUB_SHA:$GITHUB_REF - name: Get Tag Type run: | From 11512fe1c8fff3d8c6514afb8761f40f1c1ff62a Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 18:21:18 +0000 Subject: [PATCH 18/26] Fix spelling --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1fd2f59..3ed1c8c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -515,7 +515,7 @@ jobs: - name: Checkout run: | git init . - git remote add origin GITHUB_SERVER_URL/$GITHUB_REPOSITORY + git remote add origin $GITHUB_SERVER_URL/$GITHUB_REPOSITORY git fetch --tags origin +$GITHUB_SHA:$GITHUB_REF - name: Get Tag Type From d8fa2ef9da253edf1c0e1d43e18f7cb09443045a Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 19:00:40 +0000 Subject: [PATCH 19/26] Return the tags check to the releases, use our own clone and remove all the debug output --- .github/workflows/tests.yml | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3ed1c8c..9de74da 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -485,6 +485,7 @@ jobs: # upload_release: name: Upload Release Assets + if: startsWith(github.ref, 'refs/tags/') needs: - package_dpkg - package_rpm @@ -504,7 +505,7 @@ jobs: # # Normally, `git for-each-ref refs/tags` will show annotated tags # with a type of "tag" and lightweight with type "commit". - # But not with this checkout + # But not with the actions/checkout@v2 checkout # # Additionally, it seems that if you push both a commit and an annotated # tag at the same time, two workflow actions start (as expected), and @@ -515,37 +516,13 @@ jobs: - name: Checkout run: | git init . - git remote add origin $GITHUB_SERVER_URL/$GITHUB_REPOSITORY - git fetch --tags origin +$GITHUB_SHA:$GITHUB_REF + git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY - name: Get Tag Type run: | - echo ================Debug - echo ls .git/refs/heads - ls .git/refs/heads - echo ls .git/refs/tags - ls .git/refs/tags - echo ================ TYPE=$(git cat-file -t $GITHUB_REF) echo "::set-output name=TAGTYPE::$TYPE" - echo ================Debug - echo REF=$GITHUB_REF - echo TAGTYPE=$TYPE - echo ================ - echo git for-each-ref refs/tags - git for-each-ref refs/tags - echo ================ - echo git for-each-ref refs/heads - git for-each-ref refs/heads - echo ================ - echo git cat-file $TYPE $GITHUB_REF - git cat-file $TYPE $GITHUB_REF - echo ================ - echo cat .git/$GITHUB_REF || true - cat .git/$GITHUB_REF || true - echo ================ - - name: Fetch all Artifacts if: steps.get_tagtype.outputs.TAGTYPE == 'tag' uses: actions/download-artifact@v2 From 88bd8e566f4196b562858c68438c0c7462a45039 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 19:16:47 +0000 Subject: [PATCH 20/26] Fix clone command, removing the half removed old fetch-based command --- .github/workflows/tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9de74da..50a3482 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -515,8 +515,7 @@ jobs: # - name: Checkout run: | - git init . - git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY + git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY . - name: Get Tag Type run: | From f2f49111b7eff08704d24a47b35937172cd0d7cb Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 19:28:42 +0000 Subject: [PATCH 21/26] Add reference to a ticket for this problem --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 50a3482..ad4ed46 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -513,6 +513,9 @@ jobs: # - the annodated tag is visible in the "commit" action # - but it looks like a lightweight tag in the "tag" action # + # See https://github.com/actions/checkout/issues/290 for a whole lot of + # 'no comment' from github + # - name: Checkout run: | git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY . From 5b5fe587aed4bd58d3958ae5627264d991d324f5 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 19:37:11 +0000 Subject: [PATCH 22/26] Attempt to fix github tags in each job See https://github.com/actions/checkout/issues/290 for some discussion. --- .github/workflows/tests.yml | 61 ++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ad4ed46..9d80a7d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -251,6 +251,10 @@ jobs: with: fetch-depth: 0 + - name: Fix Checkout + run: | + git fetch --force --tags + - name: Install packages needed for build run: | sudo apt-get update @@ -293,6 +297,10 @@ jobs: with: fetch-depth: 0 + - name: Fix Checkout + run: | + git fetch --force --tags + - name: Install packages needed for build run: | sudo apt-get install rpm @@ -328,6 +336,10 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Fix Checkout + run: | + git fetch --force --tags + - name: Configure and Build shell: bash run: | @@ -360,6 +372,10 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Fix Checkout + run: | + git fetch --force --tags + - name: Install packages needed for build run: | brew install automake @@ -403,6 +419,10 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Fix Checkout + run: | + git fetch --force --tags + - name: Install packages needed for build run: | brew install automake @@ -452,6 +472,10 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Fix Checkout + run: | + git fetch --force --tags + - name: Install cross compiler run: | sudo apt-get update @@ -481,7 +505,14 @@ jobs: # Given the clearly documented use of annotated tags to signal releases, # it seems strange that there is no simple way to trigger actions if the - # tag is annotated. So we need to jump through some hoops. + # tag is annotated. So we need to jump through some extra hoops. + # + # Looking at https://github.com/actions/checkout/issues/290 seems to show + # that github just doesnt care about how git expects annotated tags to be + # used. + # + # This workflow has added a `git fetch --force --tags` to every job that + # needs to have working tags # upload_release: name: Upload Release Assets @@ -496,29 +527,11 @@ jobs: runs-on: ubuntu-latest steps: - # There is something strange with the repo that you end up with - # using actions/checkout@v2. - # - # It appears that the repository that is checked out as part of a tag - # action does not have the correct tag object in it. As a work around, - # we dont use the actions/checkout@v2 - # - # Normally, `git for-each-ref refs/tags` will show annotated tags - # with a type of "tag" and lightweight with type "commit". - # But not with the actions/checkout@v2 checkout - # - # Additionally, it seems that if you push both a commit and an annotated - # tag at the same time, two workflow actions start (as expected), and - # the two checkouts show different things: - # - the annodated tag is visible in the "commit" action - # - but it looks like a lightweight tag in the "tag" action - # - # See https://github.com/actions/checkout/issues/290 for a whole lot of - # 'no comment' from github - # - - name: Checkout - run: | - git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY . + - uses: actions/checkout@v2 + + - name: Fix Checkout + run: | + git fetch --force --tags - name: Get Tag Type run: | From 3c3a848dc2c30880ea35b280e2ca29c063a17c71 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 19:51:22 +0000 Subject: [PATCH 23/26] Re-add much of the debug output --- .github/workflows/tests.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9d80a7d..77e7f4b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -537,6 +537,24 @@ jobs: run: | TYPE=$(git cat-file -t $GITHUB_REF) echo "::set-output name=TAGTYPE::$TYPE" + echo ========== + echo REF=$GITHUB_REF + echo TAGTYPE=$GITHUB_REF + echo ========== + echo git cat-file $GITHUB_REF + git cat-file $GITHUB_REF + echo ========== + echo ls .git/refs/heads + ls .git/refs/heads + echo ========== + echo ls .git/refs/tags + ls .git/refs/tags + echo ========== + echo git for-each-ref refs/heads + git for-each-ref refs/heads + echo ========== + echo git for-each-ref refs/tags + git for-each-ref refs/tags - name: Fetch all Artifacts if: steps.get_tagtype.outputs.TAGTYPE == 'tag' From 02f341df873f588aa01f64cbbbe1d15a79f25906 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 20:14:22 +0000 Subject: [PATCH 24/26] Add a debugging job to show the get tagtype data quicker in the workflow --- .github/workflows/tests.yml | 47 +++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 77e7f4b..3bb2474 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -514,16 +514,9 @@ jobs: # This workflow has added a `git fetch --force --tags` to every job that # needs to have working tags # - upload_release: - name: Upload Release Assets + get_tagtype: + name: Get type of Tag if: startsWith(github.ref, 'refs/tags/') - needs: - - package_dpkg - - package_rpm - - binaries_windows - - binaries_macos - - binaries_macos_universal - - binaries_linux_crosscompile runs-on: ubuntu-latest steps: @@ -533,16 +526,15 @@ jobs: run: | git fetch --force --tags - - name: Get Tag Type + - name: Debug data for Get Tag Type run: | TYPE=$(git cat-file -t $GITHUB_REF) - echo "::set-output name=TAGTYPE::$TYPE" echo ========== echo REF=$GITHUB_REF echo TAGTYPE=$GITHUB_REF echo ========== - echo git cat-file $GITHUB_REF - git cat-file $GITHUB_REF + echo git cat-file $TYPE $GITHUB_REF + git cat-file $TYPE $GITHUB_REF echo ========== echo ls .git/refs/heads ls .git/refs/heads @@ -556,6 +548,35 @@ jobs: echo git for-each-ref refs/tags git for-each-ref refs/tags + + upload_release: + name: Upload Release Assets + if: startsWith(github.ref, 'refs/tags/') + needs: + - package_dpkg + - package_rpm + - binaries_windows + - binaries_macos + - binaries_macos_universal + - binaries_linux_crosscompile + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Fix Checkout + run: | + git fetch --force --tags + + - name: Get Tag Type + id: get_tagtype + run: | + TYPE=$(git cat-file -t $GITHUB_REF) + echo "::set-output name=TAGTYPE::$TYPE" + echo ========== + echo REF=$GITHUB_REF + echo TAGTYPE=$GITHUB_REF + - name: Fetch all Artifacts if: steps.get_tagtype.outputs.TAGTYPE == 'tag' uses: actions/download-artifact@v2 From 5055259171b38a692bb80582ccf5716a2c0ee2d6 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 20:16:06 +0000 Subject: [PATCH 25/26] Output correct debug data... --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3bb2474..2144e1c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -531,7 +531,7 @@ jobs: TYPE=$(git cat-file -t $GITHUB_REF) echo ========== echo REF=$GITHUB_REF - echo TAGTYPE=$GITHUB_REF + echo TAGTYPE=$TYPE echo ========== echo git cat-file $TYPE $GITHUB_REF git cat-file $TYPE $GITHUB_REF @@ -575,7 +575,7 @@ jobs: echo "::set-output name=TAGTYPE::$TYPE" echo ========== echo REF=$GITHUB_REF - echo TAGTYPE=$GITHUB_REF + echo TAGTYPE=$TYPE - name: Fetch all Artifacts if: steps.get_tagtype.outputs.TAGTYPE == 'tag' From 9f7ea8922940f44d33cc5ce4515a09cb2a313db0 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 20:28:30 +0000 Subject: [PATCH 26/26] Remove debugging outputs --- .github/workflows/tests.yml | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2144e1c..8b8e8e0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -513,41 +513,6 @@ jobs: # # This workflow has added a `git fetch --force --tags` to every job that # needs to have working tags - # - get_tagtype: - name: Get type of Tag - if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Fix Checkout - run: | - git fetch --force --tags - - - name: Debug data for Get Tag Type - run: | - TYPE=$(git cat-file -t $GITHUB_REF) - echo ========== - echo REF=$GITHUB_REF - echo TAGTYPE=$TYPE - echo ========== - echo git cat-file $TYPE $GITHUB_REF - git cat-file $TYPE $GITHUB_REF - echo ========== - echo ls .git/refs/heads - ls .git/refs/heads - echo ========== - echo ls .git/refs/tags - ls .git/refs/tags - echo ========== - echo git for-each-ref refs/heads - git for-each-ref refs/heads - echo ========== - echo git for-each-ref refs/tags - git for-each-ref refs/tags - upload_release: name: Upload Release Assets