Skip to content

Commit 546aeb2

Browse files
authored
Codechange: [CI] use setup-vcpkg action (#61)
1 parent a92928e commit 546aeb2

3 files changed

Lines changed: 21 additions & 49 deletions

File tree

.github/workflows/ci-build.yml

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
steps:
2828
- name: Checkout
29-
uses: actions/checkout@v5
29+
uses: actions/checkout@v6
3030

3131
- name: Install dependencies
3232
run: |
@@ -75,24 +75,15 @@ jobs:
7575

7676
steps:
7777
- name: Checkout
78-
uses: actions/checkout@v5
78+
uses: actions/checkout@v6
7979

80-
- name: Setup vcpkg caching
81-
uses: actions/github-script@v8
82-
with:
83-
script: |
84-
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
85-
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
86-
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
87-
88-
- name: Install vcpkg
89-
run: |
90-
git clone https://github.com/microsoft/vcpkg
91-
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
80+
- name: Setup vcpkg
81+
id: vcpkg
82+
uses: OpenTTD/actions/setup-vcpkg@v6
9283

9384
- name: Prepare vcpkg
9485
run: |
95-
./vcpkg/vcpkg install --triplet=${{ matrix.arch }}-osx \
86+
${{ steps.vcpkg.outputs.vcpkg }} install --triplet=${{ matrix.arch }}-osx \
9687
boost-bimap \
9788
boost-date-time \
9889
boost-foreach \
@@ -110,7 +101,7 @@ jobs:
110101
cmake ${GITHUB_WORKSPACE} \
111102
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.full_arch }} \
112103
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-osx \
113-
-DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/vcpkg/scripts/buildsystems/vcpkg.cmake \
104+
-DCMAKE_TOOLCHAIN_FILE=${{ steps.vcpkg.outputs.vcpkg-cmake }} \
114105
# EOF
115106
echo "::endgroup::"
116107
@@ -132,25 +123,16 @@ jobs:
132123

133124
steps:
134125
- name: Checkout
135-
uses: actions/checkout@v5
126+
uses: actions/checkout@v6
136127

137-
- name: Setup vcpkg caching
138-
uses: actions/github-script@v8
139-
with:
140-
script: |
141-
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
142-
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
143-
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
144-
145-
- name: Install vcpkg
146-
run: |
147-
git clone https://github.com/microsoft/vcpkg
148-
.\vcpkg\bootstrap-vcpkg.bat -disableMetrics
128+
- name: Setup vcpkg
129+
id: vcpkg
130+
uses: OpenTTD/actions/setup-vcpkg@v6
149131

150132
- name: Prepare vcpkg
151133
shell: bash
152134
run: |
153-
./vcpkg/vcpkg install --triplet=${{ matrix.arch }}-windows-static \
135+
"${{ steps.vcpkg.outputs.vcpkg }}" install --triplet=${{ matrix.arch }}-windows-static \
154136
boost-bimap \
155137
boost-date-time \
156138
boost-foreach \
@@ -175,7 +157,7 @@ jobs:
175157
cmake .. \
176158
-GNinja \
177159
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
178-
-DCMAKE_TOOLCHAIN_FILE="${GITHUB_WORKSPACE}\vcpkg\scripts\buildsystems\vcpkg.cmake" \
160+
-DCMAKE_TOOLCHAIN_FILE="${{ steps.vcpkg.outputs.vcpkg-cmake }}" \
179161
# EOF
180162
echo "::endgroup::"
181163

.github/workflows/commit-checker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010

1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v5
13+
uses: actions/checkout@v6
1414
with:
1515
fetch-depth: 4
1616

1717
- name: Get pull-request commits
18-
uses: OpenTTD/actions/checkout-pull-request@v5
18+
uses: OpenTTD/actions/checkout-pull-request@v6
1919

2020
- name: Check commits
2121
uses: OpenTTD/OpenTTD-git-hooks@main

.github/workflows/release.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v5
16+
uses: actions/checkout@v6
1717

1818
- name: Generate .version
1919
run: |
@@ -76,24 +76,14 @@ jobs:
7676
run: |
7777
tar --xz -xf *-source.tar.xz --strip-components=1
7878
79-
- name: Setup vcpkg caching
80-
uses: actions/github-script@v8
81-
with:
82-
script: |
83-
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
84-
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
85-
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
86-
87-
- name: Install vcpkg
88-
run: |
89-
git clone https://github.com/microsoft/vcpkg
90-
.\vcpkg\bootstrap-vcpkg.bat -disableMetrics
91-
79+
- name: Setup vcpkg
80+
id: vcpkg
81+
uses: OpenTTD/actions/setup-vcpkg@v6
9282

9383
- name: Prepare vcpkg
9484
shell: bash
9585
run: |
96-
./vcpkg/vcpkg install --triplet=${{ matrix.arch }}-windows-static \
86+
"${{ steps.vcpkg.outputs.vcpkg }}" install --triplet=${{ matrix.arch }}-windows-static \
9787
boost-bimap \
9888
boost-date-time \
9989
boost-foreach \
@@ -117,7 +107,7 @@ jobs:
117107
cmake .. \
118108
-GNinja \
119109
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
120-
-DCMAKE_TOOLCHAIN_FILE="${GITHUB_WORKSPACE}\vcpkg\scripts\buildsystems\vcpkg.cmake" \
110+
-DCMAKE_TOOLCHAIN_FILE="${{ steps.vcpkg.outputs.vcpkg-cmake }}" \
121111
-DCMAKE_BUILD_TYPE=Release \
122112
# EOF
123113
echo "::endgroup::"

0 commit comments

Comments
 (0)