@@ -193,32 +193,70 @@ jobs:
193193 else
194194 DOCKER_IMAGE=${{ matrix.docker_image }} go test -tags=testcontainers -v ./mysql/... -run WithTestcontainers -timeout=30m
195195 fi
196- # DISABLED to figure out GPG signing issue on Github Actions
197- # possibly due to lack of TTY inside docker?
198- # release:
199- # name: Release
200- # needs: [tests]
201- # # Can't use non-semvar for the testing tag
202- # # https://github.com/orgs/goreleaser/discussions/3708
203- # if: ( startsWith( github.ref, 'refs/tags/v' ) ||
204- # startsWith(github.ref, 'refs/tags/v0.0.0-rc') )
205- # runs-on: ubuntu-22.04
206- # steps:
207- # - name: Checkout Git repo
208- # uses: actions/checkout@v4
196+ release :
197+ name : Release
198+ needs : [tests]
199+ # Can't use non-semvar for the testing tag
200+ # https://github.com/orgs/goreleaser/discussions/3708
201+ if : ( startsWith( github.ref, 'refs/tags/v' ) ||
202+ startsWith(github.ref, 'refs/tags/v0.0.0-rc') )
203+ runs-on : ubuntu-22.04
204+ permissions :
205+ contents : write # Required for creating releases
206+ steps :
207+ - name : Checkout Git repo
208+ uses : actions/checkout@v4
209+ with :
210+ fetch-depth : 0 # Full history needed for changelog
209211
210- # # Goreleaser
211- # - name: Set up Go
212- # uses: actions/setup-go@v4
213- # - name: Run GoReleaser
214- # uses: goreleaser/goreleaser-action@v6
215- # with:
216- # distribution: goreleaser
217- # version: '~> v2'
218- # # Run goreleaser and ignore non-committed files (downloaded artifacts)
219- # args: release --clean --skip=validate --verbose
220- # env:
221- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
212+ - name : Set up Go
213+ uses : actions/setup-go@v4
214+ with :
215+ go-version-file : go.mod
216+
217+ - name : Import GPG Subkey
218+ env :
219+ GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
220+ GPG_FINGERPRINT : ${{ secrets.GPG_FINGERPRINT }}
221+ GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
222+ run : |
223+ # Create GPG directory
224+ mkdir -p ~/.gnupg
225+ chmod 700 ~/.gnupg
226+
227+ # Configure GPG for non-interactive use with passphrase
228+ echo "use-agent" >> ~/.gnupg/gpg.conf
229+ echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
230+ echo "allow-loopback-pinentry" >> ~/.gnupg/gpg.conf
231+
232+ # Start gpg-agent with loopback pinentry
233+ gpg-agent --daemon --allow-loopback-pinentry
234+
235+ # Import the subkey
236+ echo "$GPG_PRIVATE_KEY" | gpg --batch --import --passphrase "$GPG_PASSPHRASE"
237+
238+ # Trust the key (required for signing)
239+ # Use ultimate trust (6) for the subkey
240+ echo "$GPG_FINGERPRINT:6:" | gpg --import-ownertrust
241+
242+ # Verify key is available and can sign
243+ gpg --list-secret-keys --keyid-format LONG
244+
245+ # Test signing capability
246+ echo "test" | gpg --batch --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" --sign --armor > /dev/null 2>&1 && echo "✓ GPG signing test successful"
247+
248+ - name : Run GoReleaser
249+ uses : goreleaser/goreleaser-action@v6
250+ with :
251+ distribution : goreleaser
252+ version : ' ~> v2'
253+ # Run goreleaser and ignore non-committed files (downloaded artifacts)
254+ args : release --clean --skip=validate
255+ env :
256+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
257+ GPG_FINGERPRINT : ${{ secrets.GPG_FINGERPRINT }}
258+ GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
259+ GPG_TTY : $(tty)
222260
223261 # terraform-provider-release:
224262 # needs: [release]
0 commit comments