docs(README): expand with jlink portable JRE guide, full version/buil… #1
Workflow file for this run
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: Build and Attach Release Artifacts | |
| on: | |
| release: | |
| types: [published] | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout tag | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.release.tag_name }} | |
| - name: Determine build strategy | |
| id: plan | |
| run: | | |
| TAG="${{ github.event.release.tag_name }}" | |
| if [ -z "$TAG" ]; then TAG="${GITHUB_REF_NAME}"; fi | |
| echo "Tag is $TAG" | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| if [[ "$TAG" =~ ^v1\.0\..* || "$TAG" =~ ^v1\.1\..* ]]; then | |
| echo "build_system=ant" >> $GITHUB_OUTPUT | |
| echo "java=8" >> $GITHUB_OUTPUT | |
| echo "artifact=dist/Bitbyte.jar" >> $GITHUB_OUTPUT | |
| elif [[ "$TAG" =~ ^v1\.8\..* || "$TAG" == v1.9.0 ]]; then | |
| echo "build_system=ant" >> $GITHUB_OUTPUT | |
| echo "java=17" >> $GITHUB_OUTPUT | |
| echo "artifact=dist/Bitbyte.jar" >> $GITHUB_OUTPUT | |
| else | |
| echo "build_system=gradle" >> $GITHUB_OUTPUT | |
| echo "java=25" >> $GITHUB_OUTPUT | |
| echo "artifact=build/libs/*.jar" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Set up Java (runtime + toolchain) | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: ${{ steps.plan.outputs.java }} | |
| - name: Install Ant (for legacy) | |
| if: steps.plan.outputs.build_system == 'ant' | |
| run: sudo apt-get update && sudo apt-get install -y ant | |
| - name: Build with Ant | |
| if: steps.plan.outputs.build_system == 'ant' | |
| run: ant clean jar | |
| - name: Set up Gradle 8.10.2 | |
| if: steps.plan.outputs.build_system == 'gradle' | |
| uses: gradle/actions/setup-gradle@v3 | |
| with: | |
| gradle-version: 8.10.2 | |
| - name: Build with Gradle (no caches) | |
| if: steps.plan.outputs.build_system == 'gradle' | |
| run: | | |
| gradle --version | |
| java -version | |
| gradle build -PprojVersion=${{ steps.plan.outputs.tag }} -PjavaTarget=${{ steps.plan.outputs.java }} --no-daemon --no-configuration-cache --no-build-cache --stacktrace || \ | |
| (sleep 5 && gradle build -PprojVersion=${{ steps.plan.outputs.tag }} -PjavaTarget=${{ steps.plan.outputs.java }} --no-daemon --no-configuration-cache --no-build-cache --stacktrace) | |
| - name: Prepare latest asset name | |
| id: latest | |
| shell: bash | |
| run: | | |
| ART="${{ steps.plan.outputs.artifact }}" | |
| # Resolve single file path if glob | |
| FILE="$(ls -1 ${ART} | head -n1)" | |
| echo "file=$FILE" >> $GITHUB_OUTPUT | |
| LATEST="BiByte-latest.jar" | |
| cp -f "$FILE" "$LATEST" || true | |
| echo "latest=$LATEST" >> $GITHUB_OUTPUT | |
| - name: Generate release notes (optional) | |
| run: | | |
| TAG='${{ steps.plan.outputs.tag }}' | |
| if [ "$TAG" = "v1.0.0" ]; then | |
| cat > RELEASE_NOTES.md << 'EOF' | |
| # BiByte Conversor (v1.0.0) | |
| BiByte e uma ferramenta de desktop desenvolvida em Java para auxiliar engenheiros de automacao e controle que trabalham com sistemas SCADA, especificamente com o protocolo IEC-870-5. A principal funcao da aplicacao e converter valores entre o formato "BitByte" e "PTNO", alem de fornecer tabelas de consulta rapida para localizacao de UTRs (Unidades Terminais Remotas) e codigos de cores de cabos. | |
| ## Visao Geral da Arquitetura (Versao 1.0.0 - Legado) | |
| A versao original do projeto foi desenvolvida com as seguintes tecnologias: | |
| - Java: Versao 1.7 | |
| - Build System: Apache Ant | |
| - IDE: NetBeans | |
| - UI: Java Swing | |
| - Empacotamento: Launch4j para a criacao de um executavel `.exe` para Windows. | |
| ## Estrutura do Projeto | |
| - src/: Codigo-fonte principal da aplicacao. | |
| - test/: Testes unitarios com JUnit. | |
| - dist/: Contem o JAR compilado e a documentacao Javadoc. | |
| - nbproject/: Arquivos de configuracao do projeto NetBeans. | |
| - *.xml: Arquivos de configuracao do Ant (build.xml) e Launch4j. | |
| ## Como Compilar e Executar | |
| - Requisitos: JDK 7 e Ant | |
| - Build: ant jar | |
| - Saida: dist/Bitbyte.jar | |
| EOF | |
| elif [ "$TAG" = "v1.1.0" ]; then | |
| cat > RELEASE_NOTES.md << 'EOF' | |
| # BiByte Conversor (v1.1.0) | |
| Refatoracao de qualidade de codigo e adicao de testes. | |
| - UI (MyJFrame.java): renomeacao de campos (t1/t2/t3/t4 -> bitByteInput/ptnoInput/ptnoOutput/bitByteOutput), remocao de boilerplate, lambdas no EventQueue, tratamento de excecoes unificado. | |
| - Listener: MeuListener ajustado para novos campos e errorLabel. | |
| - Logica (Calculos.java): funcoes mais puras, sem JOptionPane. | |
| - Testes: test/operacoes/CalculosTest.java (JUnit 4). | |
| Como compilar (Ant/JDK7): ant jar (gera dist/Bitbyte.jar) | |
| EOF | |
| else | |
| cat > RELEASE_NOTES.md << EOF | |
| Release ${TAG} | |
| Build system: ${{ steps.plan.outputs.build_system }} | |
| Java: ${{ steps.plan.outputs.java }} | |
| Consulte o README no tag para detalhes de versao e uso. | |
| EOF | |
| fi | |
| - name: Create/Upload release assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.plan.outputs.tag }} | |
| files: | | |
| ${{ steps.latest.outputs.file }} | |
| ${{ steps.latest.outputs.latest }} | |
| generate_release_notes: true | |
| body_path: RELEASE_NOTES.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |