From c7ba30f7fec4d695d15a44092217990f378d4178 Mon Sep 17 00:00:00 2001
From: Eugen Dueck <eugen@dueck.org>
Date: Thu, 14 Mar 2024 19:28:56 +0900
Subject: [PATCH] fix build workflow

---
 .github/workflows/build.yml | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 752f62f..316176f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -10,12 +10,12 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        go-version: [1.17.x]
-        os: [ubuntu-latest, macos-latest, windows-latest]
+        go-version: [1.21.x]
+        os: [linux, darwin, windows]
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v4
       - name: Set up Go
-        uses: actions/setup-go@v2
+        uses: actions/setup-go@v4
         with:
           go-version: ${{ matrix.go-version }}
       - name: Extract project version
@@ -24,11 +24,14 @@ jobs:
       - name: Extract commit hash
         id: git_commit
         run: echo "::set-output name=sha::$(git rev-parse --short HEAD)"
+      - name: Download dependencies
+        run: go mod tidy
       - name: Build
         run: |
           env GOOS=${{ matrix.os }} GOARCH=amd64 go build -o colorexp-${{ matrix.os }}-amd64-${{ steps.project_version.outputs.version }}-${{ steps.git_commit.outputs.sha }} colorexp.go
       - name: Upload artifact
-        uses: actions/upload-artifact@v2
+        if: github.event_name == 'push'
+        uses: actions/upload-artifact@v4
         with:
           name: colorexp-${{ matrix.os }}-amd64-${{ steps.project_version.outputs.version }}-${{ steps.git_commit.outputs.sha }}
           path: colorexp-${{ matrix.os }}-amd64-${{ steps.project_version.outputs.version }}-${{ steps.git_commit.outputs.sha }}