Add note api #97
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/entries/412 | |
pkill -KILL java | |
- name: Native Image | |
run: | | |
set -e | |
./mvnw -V --no-transfer-progress -Pnative native:compile -DskipTests | |
./target/blog-frontend --management.otlp.tracing.endpoint=https://httpbin.org/post & | |
.github/workflows/wait.sh | |
curl --fail --show-error --silent http://localhost:8080 | |
curl --fail --show-error --silent http://localhost:8080/entries/412 | |
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 ; | |
- 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.6.0 | |
- 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 \ | |
--env BP_OCI_SOURCE=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA} \ | |
--env BP_OCI_REVISION=${GITHUB_REF_NAME}@sha1:${GITHUB_SHA} \ | |
--gid 1000 \ | |
--publish \ | |
--builder paketobuildpacks/builder-jammy-tiny \ | |
--buildpack gcr.io/paketo-buildpacks/image-labels \ | |
--buildpack gcr.io/paketo-buildpacks/procfile \ | |
--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 |