Skip to content

Commit 2c4e4b0

Browse files
author
Antonis Kalipetis
committed
feat(make): better caching for repogen and goreleaesr
1 parent 026d178 commit 2c4e4b0

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
- name: Get Composer cache directory
3737
id: composer-cache
38-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
38+
run: echo "dir=$(cd legacy && composer config cache-files-dir)" >> $GITHUB_OUTPUT
3939

4040
- name: Cache Composer dependencies
4141
uses: actions/cache@v4
@@ -51,6 +51,12 @@ jobs:
5151
id: php-version
5252
run: echo "version=$(grep '^PHP_VERSION' Makefile | cut -d= -f2 | tr -d ' ')" >> $GITHUB_OUTPUT
5353

54+
- name: Get tool versions from Makefile
55+
id: tool-versions
56+
run: |
57+
echo "goreleaser=$(grep '^GORELEASER_VERSION' Makefile | cut -d= -f2 | tr -d ' ')" >> $GITHUB_OUTPUT
58+
echo "repogen=$(grep '^REPOGEN_VERSION' Makefile | cut -d= -f2 | tr -d ' ')" >> $GITHUB_OUTPUT
59+
5460
- name: Cache PHP binaries
5561
uses: actions/cache@v4
5662
id: php-cache
@@ -68,6 +74,15 @@ jobs:
6874
openssl rsa -in /tmp/rsa-signing-key.pem -pubout -out /tmp/rsa-signing-key.pub
6975
echo "${{ secrets.GPG_SIGNING_KEY }}" | base64 -d > /tmp/gpg-signing-key.asc
7076
77+
- name: Cache Go binaries
78+
uses: actions/cache@v4
79+
with:
80+
path: ~/go/bin
81+
key: ${{ runner.os }}-go-bin-goreleaser-${{ steps.tool-versions.outputs.goreleaser }}-repogen-${{ steps.tool-versions.outputs.repogen }}
82+
83+
- name: Install Go tools
84+
run: make goreleaser repogen
85+
7186
- name: Build release (tag)
7287
if: startsWith(github.ref, 'refs/tags/')
7388
env:
@@ -84,9 +99,6 @@ jobs:
8499
GPG_SIGNING_KEY_FILE: /tmp/gpg-signing-key.asc
85100
run: make snapshot
86101

87-
- name: Install repogen
88-
run: go install github.com/ralt/repogen/cmd/repogen@latest
89-
90102
- name: Configure AWS credentials
91103
uses: aws-actions/configure-aws-credentials@v4
92104
with:

‎Makefile‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ VERSION := $(shell git describe --always)
1919

2020
# Tooling versions
2121
GORELEASER_VERSION=v2.12.0
22+
REPOGEN_VERSION=v1.0.4
2223

2324
# PHP binaries are downloaded from cli-php-builds releases.
2425
# See: https://github.com/upsun/cli-php-builds
@@ -74,6 +75,10 @@ php: internal/legacy/archives/php_$(GOOS)_$(GOARCH)
7475
goreleaser:
7576
command -v goreleaser >/dev/null || go install github.com/goreleaser/goreleaser/v2@$(GORELEASER_VERSION)
7677

78+
.PHONY: repogen
79+
repogen:
80+
command -v repogen >/dev/null || go install github.com/ralt/repogen/cmd/repogen@$(REPOGEN_VERSION)
81+
7782
.PHONY: single
7883
single: goreleaser internal/legacy/archives/platform.phar php ## Build a single target release
7984
PHP_VERSION=$(PHP_VERSION) goreleaser build --single-target --id=$(GORELEASER_ID) --snapshot --clean

0 commit comments

Comments
 (0)