kjellmlarsson triggered build #37
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 Liberty image with war file | |
run-name: ${{ github.actor }} triggered build | |
on: [push] | |
jobs: | |
build-image-with-war-file: | |
# Add package write permission to the GitHub Token that gets generated by each run. | |
# To allow the action to push, this repository needs to be given access to the package at the organization level. | |
# See: https://docs.github.com/en/packages/learn-github-packages/configuring-a-packages-access-control-and-visibility#configuring-access-to-packages-for-an-organization | |
# See: https://docs.github.com/en/packages/learn-github-packages/connecting-a-repository-to-a-package | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
# Clone repository | |
- uses: actions/checkout@v4 | |
# Run the gradle build to create the war file using the gradle wrapper | |
# The build creates the war file | |
- name: gradlew-build-war-file | |
run: | | |
./gradlew --no-daemon | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/nordic-mvp-gitops-repos/liberty-sampleapp | |
tags: | | |
# set latest tag for default branch and commit id | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=sha | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |