From e9a4d99f6ab60362988db74719b7021ffbb2df79 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 27 Aug 2021 12:39:02 +0900 Subject: [PATCH] .github/workflows: Bug fix: Specify a git commit ID Updates #1664 --- .github/workflows/sourcehutbuild.go | 6 +++++- .github/workflows/sourcehutbuild.yml | 1 + .github/workflows/sourcehutmanifests/alpine.yml | 2 +- .github/workflows/sourcehutmanifests/arch.yml | 2 +- .github/workflows/sourcehutmanifests/debian.yml | 2 +- .github/workflows/sourcehutmanifests/fedora.yml | 2 +- .github/workflows/sourcehutmanifests/ubuntu.yml | 2 +- 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sourcehutbuild.go b/.github/workflows/sourcehutbuild.go index 79b43e600..8b7486b5e 100644 --- a/.github/workflows/sourcehutbuild.go +++ b/.github/workflows/sourcehutbuild.go @@ -26,10 +26,12 @@ import ( "log" "net/http" "os" + "strings" "time" ) var ( + flagCommit = flag.String("commit", "", "git commit hash ID") flagManifest = flag.String("manifest", "", "manifest file path") flagNote = flag.String("note", "", "note for the build") ) @@ -101,8 +103,10 @@ func run() error { return err } + manifestStr := strings.ReplaceAll(string(manifest), "{{.Commit}}", *flagCommit) + body, err := httpRequest(http.MethodPost, "/api/jobs", &JobRequest{ - Manifest: string(manifest), + Manifest: manifestStr, Note: *flagNote, }) if err != nil { diff --git a/.github/workflows/sourcehutbuild.yml b/.github/workflows/sourcehutbuild.yml index 0e21a3b27..b8eee64e3 100644 --- a/.github/workflows/sourcehutbuild.yml +++ b/.github/workflows/sourcehutbuild.yml @@ -26,5 +26,6 @@ jobs: - name: Run run: | go run .github/workflows/sourcehutbuild.go \ + -commit ${{ github.event.head_commit.id }} \ -manifest .github/workflows/sourcehutmanifests/${{ matrix.os }}.yml \ -note '${{ format('{0} ({1})', github.event.head_commit.id, matrix.os) }}' diff --git a/.github/workflows/sourcehutmanifests/alpine.yml b/.github/workflows/sourcehutmanifests/alpine.yml index 876ac089f..7f50434e6 100644 --- a/.github/workflows/sourcehutmanifests/alpine.yml +++ b/.github/workflows/sourcehutmanifests/alpine.yml @@ -10,7 +10,7 @@ packages: - pkgconf - go sources: - - https://github.com/hajimehoshi/ebiten + - https://github.com/hajimehoshi/ebiten#{{.Commit}} tasks: - build: | cd ebiten diff --git a/.github/workflows/sourcehutmanifests/arch.yml b/.github/workflows/sourcehutmanifests/arch.yml index 6b620e265..d6986a830 100644 --- a/.github/workflows/sourcehutmanifests/arch.yml +++ b/.github/workflows/sourcehutmanifests/arch.yml @@ -9,7 +9,7 @@ packages: - pkg-config - go sources: - - https://github.com/hajimehoshi/ebiten + - https://github.com/hajimehoshi/ebiten#{{.Commit}} tasks: - build: | cd ebiten diff --git a/.github/workflows/sourcehutmanifests/debian.yml b/.github/workflows/sourcehutmanifests/debian.yml index 2f43d8274..7ff81b633 100644 --- a/.github/workflows/sourcehutmanifests/debian.yml +++ b/.github/workflows/sourcehutmanifests/debian.yml @@ -12,7 +12,7 @@ packages: - pkg-config - golang sources: - - https://github.com/hajimehoshi/ebiten + - https://github.com/hajimehoshi/ebiten#{{.Commit}} tasks: - build: | cd ebiten diff --git a/.github/workflows/sourcehutmanifests/fedora.yml b/.github/workflows/sourcehutmanifests/fedora.yml index 296ac5558..5687ac022 100644 --- a/.github/workflows/sourcehutmanifests/fedora.yml +++ b/.github/workflows/sourcehutmanifests/fedora.yml @@ -11,7 +11,7 @@ packages: - pkg-config - go sources: - - https://github.com/hajimehoshi/ebiten + - https://github.com/hajimehoshi/ebiten#{{.Commit}} tasks: - build: | cd ebiten diff --git a/.github/workflows/sourcehutmanifests/ubuntu.yml b/.github/workflows/sourcehutmanifests/ubuntu.yml index 4c5e60bd0..aa5e1888c 100644 --- a/.github/workflows/sourcehutmanifests/ubuntu.yml +++ b/.github/workflows/sourcehutmanifests/ubuntu.yml @@ -12,7 +12,7 @@ packages: - pkg-config - golang sources: - - https://github.com/hajimehoshi/ebiten + - https://github.com/hajimehoshi/ebiten#{{.Commit}} tasks: - build: | cd ebiten