Merge pull request #311 from bls337/main #13
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: Run pre-merge tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'pom.xml' | |
| jobs: | |
| release-jar: | |
| # build with maven to make sure things compile correctly | |
| name: Compile with maven and release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: 8 | |
| distribution: 'zulu' | |
| - name: Extract version | |
| id: pom | |
| run: | | |
| echo "POM_VERSION=$(mvn -B -Dexec.executable='echo' -Dexec.args='${project.version}' exec:exec -q)" >> $GITHUB_ENV | |
| - name: Compile Jar with maven | |
| run: mvn package | |
| - name: Find artifact and get file name | |
| id: find_artifact | |
| run: | | |
| CMD="ls ./target/LightSheetManager-*.jar | grep -v -e '-sources' -e '-javadoc'" | |
| echo "Command: $CMD" | |
| ARTIFACT_PATH=$(eval $CMD) | |
| ARTIFACT_NAME=$(basename $ARTIFACT_PATH) | |
| echo "ARTIFACT_PATH=$ARTIFACT_PATH" >> $GITHUB_ENV | |
| echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV | |
| echo "Artifact Path: $ARTIFACT_PATH" | |
| echo "Artifact Name: $ARTIFACT_NAME" | |
| - name: Create Git Tag | |
| id: create_tag | |
| run: | | |
| TAG_NAME="v${POM_VERSION}" | |
| git tag $TAG_NAME | |
| git push origin $TAG_NAME | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
| with: | |
| tag_name: v${{ env.POM_VERSION }} | |
| release_name: Release v${{ env.POM_VERSION }} | |
| body: Auto-generated release from ${{ github.ref }} | |
| draft: false | |
| prerelease: false | |
| - name: Upload Release Asset | |
| id: upload-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: ${{ env.ARTIFACT_PATH }} | |
| asset_name: ${{ env.ARTIFACT_NAME }} | |
| asset_content_type: application/java-archive |