Skip to content

Commit

Permalink
Sync github actions with pull request branch
Browse files Browse the repository at this point in the history
Maybe the Scala CI workflow on the PR branch will start working again?
  • Loading branch information
erikrozendaal committed Oct 10, 2024
1 parent 94284ce commit 7c3548e
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 19 deletions.
54 changes: 35 additions & 19 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path

name: Package release
name: Build and push container image

on:
workflow_dispatch:
release:
types: [created]

jobs:
build:
#on:
# release:
# types: [prereleased, released]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
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: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Publish to GitHub Packages
run: sbt 'Universal / publish'
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
secrets: |
"github_token=${{ github.token }}"
44 changes: 44 additions & 0 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Scala CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

env:
GITHUB_TOKEN: ${{ github.token }}

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Start PostgreSQL
run: sudo systemctl start postgresql.service
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'sbt'
- name: Initialize PostgreSQL database
run: |
sudo -u postgres -i createuser -D -R -S nsi-safnari-user
sudo -u postgres -i psql -c "ALTER USER \"nsi-safnari-user\" WITH PASSWORD 'password'"
sudo -u postgres -i createdb -O nsi-safnari-user nsi-safnari-dev
sudo -u postgres -i createdb -O nsi-safnari-user nsi-safnari-test
- name: Run tests
run: sbt test
- name: Check code formatting
run: sbt scalafmtCheckAll scalafmtSbtCheck

0 comments on commit 7c3548e

Please sign in to comment.