Develop (#96) #23
This file contains hidden or 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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| name: Release App | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Configurar ambiente | |
| run: sudo apt-get update && sudo apt-get install -y | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Set up Java | |
| uses: actions/setup-java@v2 | |
| with: | |
| distribution: 'adopt' | |
| java-version: '21' | |
| - name: Build with Maven | |
| run: mvn clean install | |
| - name: Set up Git | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Actions" | |
| - name: Set timestamp | |
| id: timestamp | |
| run: echo "::set-output name=ts::$(date +%y.%m.%d)" | |
| - name: Ler versão com Maven | |
| id: version | |
| run: | | |
| VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| echo "VERSION=$VERSION" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Capture commit messages | |
| run: | | |
| COMMIT_MESSAGES=$(git log --pretty=oneline) | |
| echo "COMMIT_MESSAGES=${COMMIT_MESSAGES}" >> $GITHUB_ENV | |
| - name: Criar tag | |
| run: | | |
| git config --global user.name "${{ github.actor }}" | |
| git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
| git tag -a v${{ steps.version.outputs.version }} -m "Release v${{ steps.version.outputs.version }}" | |
| git push origin v${{ steps.version.outputs.version }} | |
| - name: Criar Release | |
| uses: actions/create-release@v1 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| name: Release v${{ steps.version.outputs.version }} | |
| body: | | |
| ## Changelog | |
| ${{ env.COMMIT_MESSAGES }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build Docker Image | |
| run: docker build -t ungaratto93/api-fx:v${{ steps.timestamp.outputs.ts }} . | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Push Docker Image | |
| run: docker push ungaratto93/api-fx:v${{ steps.timestamp.outputs.ts }} |