insurance: Fix excel export for coverage in vehicle #62
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: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Prepare java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
- name: Install clojure tools | |
uses: DeLaGuardo/[email protected] | |
with: | |
cli: latest # Clojure CLI based on tools.deps | |
bb: latest # Babashka | |
clj-kondo: latest # Clj-kondo | |
cljfmt: latest # cljfmt | |
cljstyle: latest # cljstyle | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache clojure dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.m2/repository | |
~/.gitlibs | |
~/.deps.clj | |
key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }} | |
restore-keys: cljdeps- | |
- name: Build pre-artifacts | |
run: | | |
bb npm-install | |
bb prod-css | |
bb compile | |
- name: Build uberjar | |
run: bb uberjar | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup variables | |
id: vars | |
run: | | |
build_date=$(date +%Y%m%d%H%M) | |
echo "build-date=${build_date}" >> "$GITHUB_OUTPUT" | |
echo "git-hash=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
type=ref,event=pr | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Debug | |
run: | | |
echo "${{ steps.vars.outputs.build-date }}" | |
#platforms: linux/amd64,linux/arm64 | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
context: . | |
file: ./docker/Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64 | |
build-args: | | |
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} | |
GIT_HASH=${{ steps.vars.outputs.git-hash }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- build-and-push | |
environment: snorga.streetnoise.at | |
steps: | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh | |
chmod 0700 ~/.ssh | |
touch ~/.ssh/id_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | |
touch ~/.ssh/known_hosts | |
chmod 640 ~/.ssh/known_hosts | |
ssh-keyscan -t ssh-ed25519 ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts | |
- name: Deploy the service | |
run: ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} 'snorga.streetnoise.at' |