Skip to content

Commit

Permalink
add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ecostanzi committed May 17, 2024
1 parent 98e0b21 commit 94fbef7
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build Release JARs and docker containers

on:
push:
tags:
- '*'


jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'

- name: Build JAR
run: ./mvnw package

- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
body: my wonderful release ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ github.token }}

- name: upload linux artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/twelve-factor-demo.jar
asset_name: twelve-factor-demo-${{ github.ref_name }}.jar
asset_content_type: application/zip

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Docker registry
uses: docker/#-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker container
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: intesys/twelve-factor-app-kotlin:${{ github.ref_name }}
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build JARs and docker containers

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '21'
distribution: 'adopt'

- name: Build JAR
run: ./mvnw package

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Docker registry
uses: docker/#-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker container
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: intesys/twelve-factor-app-kotlin:latest

- name: Upload JAR artifact
uses: actions/upload-artifact@v2
with:
name: twelve-factor-demo.jar
path: target/twelve-factor-demo.jar

0 comments on commit 94fbef7

Please # to comment.