Skip to content

github actions is kinda bad ngl #18

github actions is kinda bad ngl

github actions is kinda bad ngl #18

Workflow file for this run

name: Build and Deploy
on:
release:
types:
- created
push:
# branches:
# - main
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
server-id: github
settings-path: ${{ github.workspace }}
- name: Install dependencies
run: cd src/main/frontend && npm i
- name: Build with Maven
run: mvn -B package --file pom.xml -Dproject.version=${GITHUB_REF_NAME:1}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: app
path: |
target/billtracker-${GITHUB_REF_NAME:1}.jar
publish_maven:
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
- name: Install dependencies
run: cd src/main/frontend && npm i
- uses: actions/download-artifact@v4
with:
name: app
- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s ./settings.xml -Dgithub.token=${{ secrets.ACCESS_TOKEN }}
publish_container:
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install dependencies
run: cd src/main/frontend && npm i
- uses: actions/download-artifact@v4
with:
name: app
- name: Build Container Image
run: docker build . -t ghcr.io/kerosene-labs/billtracker:${{ github.ref_name }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.ACCESS_TOKEN }}
- name: Push Container Image
run: docker push ghcr.io/kerosene-labs/billtracker:${{ github.ref_name }}