-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (68 loc) · 2.28 KB
/
release.yml
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# after completion it'll publish and release the build artifacts and deploy to dockerhub, aws
name: Java release artifact
on:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
services:
rabbitmq:
image: rabbitmq:3.8
env:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
ports:
- 5672:5672
- 15672:15672
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: '4.4'
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Get Version
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:11}) # changed 10 -> 11 for ignoring "v" in docker
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Change wrapper permissions
run: chmod +x ./mvnw
- name: Build Image
run: ./mvnw spring-boot:build-image
- name: Push Image
run: docker push anshulsaraf/luffy:${{env.RELEASE_VERSION}}
- name: Release Artifacts
uses: ncipollo/release-action@v1
with:
artifacts: "target/Luffy.jar"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: Build Artifacts
path: target/*.jar
- name: Deploy Artifacts to AWS
uses: einaregilsson/beanstalk-deploy@v18
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: luffy
environment_name: Luffy-env
version_label: "${{env.RELEASE_VERSION}}"
region: ap-south-1
deployment_package: "target/Luffy.jar"