Skip to content

Tag Build and Deploy #26

Tag Build and Deploy

Tag Build and Deploy #26

# 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 }}