-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (65 loc) · 2.33 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: CI
on: [ push, pull_request, workflow_dispatch ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Import Secrets
id: secrets
uses: hashicorp/[email protected]
with:
exportToken: true
exportEnv: true
method: jwt
url: ${{ secrets.VAULT_ADDR }}
role: cicd
secrets: |
kv/data/cicd/github api_token | GITHUB_API_TOKEN
- name: Docker Login
run: docker login ghcr.io -u ${{ github.repository_owner }} -p ${GITHUB_API_TOKEN}
- name: Install Pack
uses: buildpacks/github-actions/[email protected]
- name: Install GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
cache: 'maven'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Unit Tests
run: ./mvnw -V --no-transfer-progress clean test
- name: Executable Jar
run: |
set -e
./mvnw -V --no-transfer-progress package -DskipTests
java -jar target/ssr-react-spring-boot-graalvm-js-0.0.1-SNAPSHOT.jar &
.github/workflows/wait.sh
curl --fail --show-error --silent http://localhost:8080
curl --fail --show-error --silent http://localhost:8080/posts/1
pkill -KILL java
- name: Native Image
run: |
set -e
./mvnw -V --no-transfer-progress -Pnative native:compile -DskipTests
./target/ssr-react-spring-boot-graalvm-js &
.github/workflows/wait.sh
curl --fail --show-error --silent http://localhost:8080
curl --fail --show-error --silent http://localhost:8080/posts/1
pkill -KILL ssr-react-spring-boot-graalvm-js || true
- name: Pack Build
if: github.ref == 'refs/heads/main'
run: |
mkdir -p pack
mv ./target/ssr-react-spring-boot-graalvm-js ./pack
cat <<EOF > pack/Procfile
web: ./ssr-react-spring-boot-graalvm-js
EOF
pack build ghcr.io/${{ github.repository_owner }}/ssr-react-spring-boot-graalvm-js --gid 1000 --publish --builder paketobuildpacks/builder-jammy-tiny --path pack
- name: Revoke token
if: always()
run: |
curl -X POST -s -H "X-Vault-Token: ${VAULT_TOKEN}" ${{ secrets.VAULT_ADDR }}/v1/auth/token/revoke-self