-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (60 loc) · 2.19 KB
/
build-and-push-tag.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
# 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: Tag Build and Deploy
on:
push:
tags:
- 'v*'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 1.11
uses: actions/setup-java@v1
with:
java-version: 1.11
- name: Build with Maven
run: |
mvn -B clean package --file pom.xml
cp ./target/seed-*-exec.jar ./target/seed.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Github Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/seed.jar
asset_name: seed-${{ env.RELEASE_VERSION }}.jar
asset_content_type: application/java-archive
#- name: Install doctl
# uses: digitalocean/action-doctl@v2
# with:
# token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
#- name: REGISTRY LOGIN
# run: doctl registry login --expiry-seconds 600
#- name: DOCKER BUILD
# run: docker build -t registry.digitalocean.com/euu/seed:${{ env.RELEASE_VERSION }} .
#- name: DOCKER PUSH
# run: docker push registry.digitalocean.com/euu/seed:${{ env.RELEASE_VERSION }}
#- name: REGISTRY LOGOUT
# run: doctl registry logout
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: DOCKER BUILD
run: docker build -t euurocks/seed:${{ env.RELEASE_VERSION }} .
- name: DOCKER PUSH
run: docker push euurocks/seed:${{ env.RELEASE_VERSION }}