-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (35 loc) · 1.3 KB
/
Copy pathbuild-image-java.yml
File metadata and controls
42 lines (35 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Creating Spring boot native
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write # need this for OIDC
contents: read
actions: write
packages: write
steps:
- uses: actions/checkout@v3
with:
ref: main
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: "11"
distribution: "adopt"
- name: Build with Maven and Buildpacks
run: mvn clean spring-boot:build-image -Dspring-boot.build-image.imageName=sbnat:latest -s settings.xml
- name: Set project version as environment variable
run: echo "PROJECT_VERSION=1.0.0" >> $GITHUB_ENV
- name: Tag and push image
env:
ECR_REGISTRY: ghcr.io
ECR_REPOSITORY: sbnat
IMAGE_TAG: ${{ env.PROJECT_VERSION }}
run: |
# Build a docker container and push it to ECR so that it can be deployed to ECS.
docker login -u ThreatWinds -p ${{ secrets.GITHUB_TOKEN }} $ECR_REGISTRY
docker image tag docker.io/library/sbnat:latest ghcr.io/c3s4rfred/sbnat:$IMAGE_TAG
docker image push $ECR_REGISTRY/c3s4rfred/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REPOSITORY:$IMAGE_TAG"