Skip to content

Repackage

Repackage #4

Workflow file for this run

name: CI
on:
push:
branches:
- main
paths:
- src/**
- ui/**
- pom.xml
- .github/workflows/*
pull_request:
branches:
- main
paths:
- src/**
- ui/**
- pom.xml
- .github/workflows/*
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Git Log
run: git log | head -n 10
- 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/blog-frontend-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/blog-frontend &
.github/workflows/wait.sh
curl --fail --show-error --silent http://localhost:8080
curl --fail --show-error --silent http://localhost:8080/posts/1
pkill -KILL blog-frontend || true
- name: Import Secrets
if: github.ref == 'refs/heads/main'
id: secrets
uses: hashicorp/vault-action@v3.0.0
with:
exportToken: true
exportEnv: true
method: jwt
url: ${{ secrets.VAULT_ADDR }}
role: cicd
secrets: |
kv/data/cicd/github api_token | GITHUB_API_TOKEN ;
kv/data/cicd/fly api_token | FLY_API_TOKEN
- name: Docker Login
if: github.ref == 'refs/heads/main'
run: docker login ghcr.io -u ${{ github.repository_owner }} -p ${GITHUB_API_TOKEN}
- name: Install Pack
if: github.ref == 'refs/heads/main'
uses: buildpacks/github-actions/setup-pack@v5.5.4
- name: Pack Build
if: github.ref == 'refs/heads/main'
run: |
mkdir -p pack
mv ./target/blog-frontend ./pack
cat <<EOF > pack/Procfile
web: ./blog-frontend
EOF
pack build ghcr.io/${{ github.repository_owner }}/blog-frontend --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 || true