Sfoglia il codice sorgente

build: Use actual Go version as cache key (#9216)

We use `env.GO_VERSION` as cache key for the build cache, but this is
nowadays typically something like `~1.21.1` which doesn't change when
1.21.2, 1.21.3 etc are released, making the cache fairly useless as
everything gets rebuilt. This re-sets the `GO_VERSION` variable after
installing Go so that it contains the actual installed version.
Jakob Borg 2 anni fa
parent
commit
8ae9db3b2d
1 ha cambiato i file con 30 aggiunte e 0 eliminazioni
  1. 30 0
      .github/workflows/build-syncthing.yaml

+ 30 - 0
.github/workflows/build-syncthing.yaml

@@ -175,6 +175,11 @@ jobs:
           cache: false
           check-latest: true
 
+      - name: Get actual Go version
+        run: |
+          go version
+          echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
+
       - uses: actions/cache@v3
         with:
           path: |
@@ -223,6 +228,11 @@ jobs:
           cache: false
           check-latest: true
 
+      - name: Get actual Go version
+        run: |
+          go version
+          echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
+
       - uses: actions/cache@v3
         with:
           path: |
@@ -265,6 +275,11 @@ jobs:
           cache: false
           check-latest: true
 
+      - name: Get actual Go version
+        run: |
+          go version
+          echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
+
       - uses: actions/cache@v3
         with:
           path: |
@@ -387,6 +402,11 @@ jobs:
           cache: false
           check-latest: true
 
+      - name: Get actual Go version
+        run: |
+          go version
+          echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
+
       - uses: actions/cache@v3
         with:
           path: |
@@ -561,6 +581,11 @@ jobs:
           cache: false
           check-latest: true
 
+      - name: Get actual Go version
+        run: |
+          go version
+          echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
+
       - uses: ruby/setup-ruby@v1
         with:
           ruby-version: '3.0'
@@ -728,6 +753,11 @@ jobs:
           cache: false
           check-latest: true
 
+      - name: Get actual Go version
+        run: |
+          go version
+          echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
+
       - uses: actions/cache@v3
         with:
           path: |