Add manual & auto release action (#36)

* feat: update dockerfile

* feat: add docker build action

* feat:add manual release action
This commit is contained in:
vran
2022-03-06 15:06:59 +08:00
committed by GitHub
parent 1f3aa9e6d9
commit 47d642152d
8 changed files with 110 additions and 43 deletions

View File

@@ -1,12 +1,12 @@
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#publishing-using-gradle
name: release
name: docker image latest push
on:
push:
tags:
- 'v*'
branches:
- 'master'
jobs:
release:
@@ -21,19 +21,25 @@ jobs:
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: add permission to gradle
- name: Gradle Permission Grant
run: chmod +x ./gradlew
- name: build with gradle
- name: Gradle Build
run: ./gradlew api:build -x checkstyleMain -x checkstyleTest
- name: release jar
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
files: api/build/libs/databasir.jar
draft: true
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Docker Image Release
uses: docker/build-push-action@v2
with:
context: .
file: ./local.Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/databasir:latest

55
.github/workflows/manual-release.yml vendored Normal file
View File

@@ -0,0 +1,55 @@
name: release
on:
workflow_dispatch:
inputs:
tag:
required: true
description: 'release tag version'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: '11'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Gradle Permission Grant
run: chmod +x ./gradlew
- name: Gradle Build
run: ./gradlew api:build -x checkstyleMain -x checkstyleTest
- name: Application Jar Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
tag_name: ${{ github.event.inputs.tag }}
files: api/build/libs/databasir.jar
draft: true
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Docker Image Release
uses: docker/build-push-action@v2
with:
context: .
file: ./local.Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/databasir:${{ github.event.inputs.tag }}