Skip to content

Commit 9d66262

Browse files
Pin github actions to specific SHAs (#662)
- Pin actions to specific SHA - Migrate to databricks hardened runners. Sadly, this means that we will have to stop making macos and arm builds for now
1 parent 3ff6d95 commit 9d66262

6 files changed

Lines changed: 130 additions & 110 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Setup Build Environment
2+
description: Sets up JDK, Node.js, and Coursier cache for building sjsonnet
3+
4+
inputs:
5+
node:
6+
description: 'Whether to install Node.js'
7+
required: false
8+
default: 'false'
9+
coursier-cache:
10+
description: 'Whether to set up Coursier cache'
11+
required: false
12+
default: 'false'
13+
sbt:
14+
description: 'Whether to install sbt'
15+
required: false
16+
default: 'false'
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Set up JDK 21
22+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # 5.2.0
23+
with:
24+
java-version: 21
25+
distribution: 'zulu'
26+
cache: ${{ inputs.sbt == 'true' && 'sbt' || '' }}
27+
- name: Set up sbt
28+
if: inputs.sbt == 'true'
29+
uses: sbt/setup-sbt@508b753e53cb6095967669e0911487d2b9bc9f41 # 1.1.22
30+
- name: Set up Node.js 24
31+
if: inputs.node == 'true'
32+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
33+
with:
34+
node-version: '24'
35+
- name: Cache Coursier cache
36+
if: inputs.coursier-cache == 'true'
37+
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # 8.1.0

.github/dependabot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ updates:
66
- package-ecosystem: "github-actions"
77
directory: "/"
88
schedule:
9-
interval: "weekly"
9+
interval: "monthly"
10+
cooldown:
11+
default-days: 7

.github/workflows/pr-build.yaml

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@ on:
44
pull_request:
55
branches: [ master ]
66

7+
permissions: {}
8+
79
jobs:
810
build-jvm:
9-
runs-on: ubuntu-22.04
11+
runs-on: linux-ubuntu-latest-hardened
1012
name: Sjsonnet jvm build
1113
steps:
12-
- uses: actions/checkout@v6
13-
- name: Set up JDK 21
14-
uses: actions/setup-java@v5
14+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
15+
- uses: ./.github/actions/setup-build
1516
with:
16-
java-version: 21
17-
distribution: 'zulu'
18-
cache: sbt
19-
- uses: sbt/setup-sbt@v1
20-
- name: Cache Coursier cache
21-
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # 8.1.0
17+
sbt: 'true'
18+
coursier-cache: 'true'
2219
- name: Check Formatting
2320
run: ./mill "_.jvm[_].__.checkFormat"
2421
- name: Run mill tests
@@ -28,43 +25,30 @@ jobs:
2825
timeout-minutes: 15
2926
run: sbt test
3027
build-graal:
31-
runs-on: ubuntu-22.04
28+
runs-on: linux-ubuntu-latest-hardened
3229
name: Sjsonnet Graal Native build
3330
steps:
34-
- uses: actions/checkout@v6
35-
- name: Set up JDK 21
36-
uses: actions/setup-java@v5
31+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
32+
- uses: ./.github/actions/setup-build
3733
with:
38-
java-version: 21
39-
distribution: 'zulu'
40-
- name: Cache Coursier cache
41-
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # 8.1.0
34+
coursier-cache: 'true'
4235
- name: Run Native Image Test Suites
4336
timeout-minutes: 15
4437
run: sjsonnet/test/graalvm/run_test_suites.py
4538
build-other:
46-
runs-on: ubuntu-22.04
39+
runs-on: linux-ubuntu-latest-hardened
4740
strategy:
4841
fail-fast: false
4942
matrix:
5043
lang: ['js', 'wasm', 'native']
5144
name: Sjsonnet ${{ matrix.lang }} build
5245
steps:
53-
- uses: actions/checkout@v6
54-
- name: Set up JDK 21
55-
uses: actions/setup-java@v5
56-
with:
57-
java-version: 21
58-
distribution: 'zulu'
59-
cache: sbt
60-
- uses: sbt/setup-sbt@v1
61-
- name: Set up Node.js 24
62-
if: ${{ matrix.lang == 'js' || matrix.lang == 'wasm' }}
63-
uses: actions/setup-node@v6
46+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
47+
- uses: ./.github/actions/setup-build
6448
with:
65-
node-version: '24'
66-
- name: Cache Coursier cache
67-
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # 8.1.0
49+
node: ${{ matrix.lang == 'js' || matrix.lang == 'wasm' }}
50+
sbt: 'true'
51+
coursier-cache: 'true'
6852
- name: Check Formatting
6953
run: ./mill _.${{ matrix.lang }}[_].__.checkFormat
7054
- name: Run mill tests for ${{ matrix.lang }}

.github/workflows/push-to-central.yaml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
11
name: Push To Maven Central
22

33
on:
4-
release:
5-
types: [published]
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Release tag (e.g. 0.4.14)'
8+
required: true
9+
type: string
10+
11+
permissions: {}
612

713
jobs:
14+
validate-tag:
15+
uses: ./.github/workflows/validate-tag.yaml
16+
with:
17+
tag: ${{ inputs.tag }}
818
publish:
9-
runs-on: ubuntu-22.04
19+
needs: validate-tag
20+
runs-on: linux-ubuntu-latest-hardened
21+
permissions:
22+
contents: read
23+
environment: production
1024
steps:
11-
- uses: actions/checkout@v6
12-
- name: Set up JDK 21
13-
uses: actions/setup-java@v5
25+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
1426
with:
15-
java-version: 21
16-
distribution: 'zulu'
17-
- name: Set up Node.js 24
18-
uses: actions/setup-node@v6
27+
ref: ${{ inputs.tag }}
28+
- uses: ./.github/actions/setup-build
1929
with:
20-
node-version: '24'
21-
30+
node: 'true'
2231
- run: ./mill mill.javalib.SonatypeCentralPublishModule/
2332
env:
2433
MILL_PGP_SECRET_BASE64: ${{ secrets.MILL_PGP_SECRET_BASE64 }}

.github/workflows/release-build.yaml

Lines changed: 25 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
name: Release Build
22

33
on:
4-
push:
5-
tags:
6-
- "*.*.*"
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Release tag (e.g. 0.4.14)'
8+
required: true
9+
type: string
10+
11+
permissions: {}
712

813
jobs:
14+
validate-tag:
15+
uses: ./.github/workflows/validate-tag.yaml
16+
with:
17+
tag: ${{ inputs.tag }}
918
release:
19+
needs: validate-tag
1020
permissions:
11-
contents: write
12-
runs-on: ubuntu-22.04
21+
contents: read
22+
runs-on: linux-ubuntu-latest-hardened
1323
env:
1424
LANG: C
1525
steps:
16-
- uses: actions/checkout@v6
17-
- name: Set up JDK 21
18-
uses: actions/setup-java@v5
26+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
1927
with:
20-
java-version: 21
21-
distribution: 'zulu'
22-
- name: Set up Node.js 24
23-
uses: actions/setup-node@v6
28+
ref: ${{ inputs.tag }}
29+
- uses: ./.github/actions/setup-build
2430
with:
25-
node-version: '24'
31+
node: 'true'
2632
- name: Set up environment variables
2733
run: |
2834
echo "VERSION=$(cat sjsonnet/version)" >> $GITHUB_ENV
@@ -48,71 +54,26 @@ jobs:
4854
cp ./out/sjsonnet/jvm/$SCALA_VERSION/client/assembly.dest/out.jar ./release/sjsonnet-client-$VERSION.jar
4955
cp ./out/sjsonnet/jvm/$SCALA_VERSION/server/assembly.dest/out.jar ./release/sjsonnet-server-$VERSION.jar
5056
cp ./out/playground/bundle.dest/index.html ./release/sjsonnet-playground-$VERSION.html
51-
- uses: actions/upload-artifact@v7
57+
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
5258
name: Upload Artifacts
5359
with:
5460
name: sjsonnet-${{ env.VERSION }}-jvmjswasm
5561
path: release/*
5662
retention-days: 1
5763
if-no-files-found: error
58-
release-native:
59-
permissions:
60-
contents: write
61-
strategy:
62-
matrix:
63-
platform:
64-
- name: linux-x86_64
65-
os: ubuntu-22.04
66-
- name: linux-arm64
67-
os: ubuntu-22.04-arm
68-
- name: darwin-x86_64
69-
os: macos-15-intel
70-
- name: darwin-arm64
71-
os: macos-15
72-
runs-on: ${{ matrix.platform.os }}
73-
env:
74-
LANG: C
75-
steps:
76-
- uses: actions/checkout@v6
77-
- name: Set up JDK 21
78-
uses: actions/setup-java@v5
79-
with:
80-
java-version: 21
81-
distribution: 'zulu'
82-
- name: Set up environment variables
83-
run: |
84-
echo "VERSION=$(cat sjsonnet/version)" >> $GITHUB_ENV
85-
echo "SCALA_VERSION=3.3.7" >> $GITHUB_ENV
86-
- name: Native Binary Build
87-
run: ./mill "sjsonnet.native[$SCALA_VERSION].nativeLink"
88-
- name: GraalVM Binary Build
89-
run: ./mill "sjsonnet.graal.nativeImage"
90-
- name: Rename Artifacts
91-
run: |
92-
mkdir release
93-
cp ./out/sjsonnet/native/$SCALA_VERSION/nativeLink.dest/out ./release/sjsonnet-$VERSION-${{ matrix.platform.name }}
94-
cp ./out/sjsonnet/graal/nativeImage.dest/native-executable ./release/sjsonnet-graalvm-$VERSION-${{ matrix.platform.name }}
95-
- uses: actions/upload-artifact@v7
96-
name: Upload Native Binary
97-
with:
98-
name: sjsonnet-${{ env.VERSION }}-${{ matrix.platform.name }}
99-
path: release/*
100-
retention-days: 1
101-
if-no-files-found: error
10264
create-release-package:
10365
permissions:
104-
contents: write
66+
contents: read
10567
needs:
10668
- release
107-
- release-native
108-
runs-on: ubuntu-22.04
69+
runs-on: linux-ubuntu-latest-hardened
10970
steps:
110-
- uses: actions/checkout@v6
71+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
11172
- name: Set up environment variables
11273
run: |
11374
echo "VERSION=$(cat sjsonnet/version)" >> $GITHUB_ENV
11475
mkdir -p release
115-
- uses: actions/download-artifact@v8
76+
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
11677
name: Download Artifacts
11778
with:
11879
path: release
@@ -123,7 +84,7 @@ jobs:
12384
ls -la
12485
sha256sum sjsonnet-* > sums.sha256
12586
popd
126-
- uses: actions/upload-artifact@v7
87+
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
12788
name: Upload Package
12889
with:
12990
name: sjsonnet-${{ env.VERSION }}-release
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Validate Tag
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
tag:
7+
description: 'Tag to validate'
8+
required: true
9+
type: string
10+
11+
permissions: {}
12+
13+
jobs:
14+
validate-tag:
15+
runs-on: linux-ubuntu-latest-hardened
16+
permissions:
17+
contents: read
18+
steps:
19+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
20+
with:
21+
fetch-depth: 0
22+
- name: Validate tag exists
23+
run: |
24+
if ! git tag --list | grep -qx '${{ inputs.tag }}'; then
25+
echo "::error::Tag '${{ inputs.tag }}' does not exist"
26+
exit 1
27+
fi

0 commit comments

Comments
 (0)