Add second phase to pipeline. Rename pipeline

This commit is contained in:
Gabri Botha 2021-06-04 11:52:57 +02:00
parent badcc1d801
commit 3a324457bf
3 changed files with 54 additions and 32 deletions

54
.github/workflows/dev_pipeline.yml vendored Normal file
View file

@ -0,0 +1,54 @@
name: Development pipeline
on:
push:
branches:
kubify
pull_request:
branches:
main
release:
types:
published
jobs:
build:
name: Build spring boot application and package jars
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- run: mvn -B package --file pom.xml
- run: mvn --batch-mode --update-snapshots verify
- run: mkdir staging && cp target/*.jar staging
- uses: actions/upload-artifact@v2
with:
name: application-jars
path: staging
package:
name: Build Docker image and push to GitHub Packages
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Retrieve jars
uses: actions/download-artifact@v2
with:
name: application-jars
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker image
uses: docker/build-push-action@v2
with:
push: true
tags: |
docker.pkg.github.com/${{ github.repository }}/spring-petclinic-image:${{ github.sha }}
docker.pkg.github.com/${{ github.repository }}/spring-petclinic-image:${{ github.ref }}

View file

@ -1,32 +0,0 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Build with Maven
run: mvn -B package --file pom.xml
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)

View file