Liberar nova versão #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Liberar nova versão | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '3.*' | |
jobs: | |
package: | |
runs-on: ubuntu-20.04 | |
name: Empacotar executavel | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v2 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
cache: maven | |
- name: Cache local Maven repository | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Ajustando Timezone | |
uses: szenius/[email protected] | |
with: | |
timezoneLinux: "America/Sao_Paulo" | |
timezoneMacos: "America/Sao_Paulo" | |
timezoneWindows: "America/Sao_Paulo" | |
- name: Set Release version env variable | |
run: | | |
mvn versions:set -DremoveSnapshot -DgenerateBackupPoms=false | |
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
IFS='.' read -ra VER <<< "${{ env.RELEASE_VERSION }}" | |
MAJOR=${VER[0]} | |
MINOR=${VER[1]} | |
let "PREV_MINOR=MINOR-1" | |
RELEASE_VERSION="${MAJOR}.${PREV_MINOR}" | |
echo "PREV_VERSION=$PREV_VERSION" >> $GITHUB_ENV | |
- name: Criando executavel | |
run: | | |
mvn versions:set -DnewVersion=${{ env.RELEASE_VERSION }} | |
mvn -B assembly:single --file pom.xml | |
- name: Criando pasta para External Jar | |
run: | | |
mkdir java-certificado | |
cp target/*.jar java-certificado | |
- uses: montudor/action-zip@v1 | |
with: | |
args: zip -qq -r java-certificado-${{ env.RELEASE_VERSION }}.zip java-certificado | |
- name: Criando release | |
uses: actions/create-release@v1 | |
id: create_release | |
with: | |
draft: false | |
prerelease: false | |
release_name: ${{ steps.version.outputs.version }} | |
tag_name: ${{ github.ref }} | |
body_path: CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Subir executavel (zip) para release external jar | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./java-certificado-${{ env.RELEASE_VERSION }}.zip | |
asset_name: java-certificado-${{ env.RELEASE_VERSION }}.zip | |
asset_content_type: application/zip |