From e8f41b99533771d53d2c78d3999d5588b3590055 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Mon, 1 Jan 2024 20:51:37 -0500 Subject: [PATCH] Added testing if-statement. --- .github/workflows/publish-release.yaml | 61 ++++++++++++++++++++++++++ .github/workflows/run-tests.yaml | 4 ++ 2 files changed, 65 insertions(+) create mode 100644 .github/workflows/publish-release.yaml diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml new file mode 100644 index 0000000..ce70b89 --- /dev/null +++ b/.github/workflows/publish-release.yaml @@ -0,0 +1,61 @@ +name: Publish Release +on: + push: + branches: + - "main" + tags: + - "v*" +jobs: + make_empty_release: + runs-on: ubuntu-latest + outputs: + version: ${{steps.get_version.outputs.tag_version}} + upload_url: ${{steps.create_release.outputs.upload_url}} + steps: + - name: Extract Tag Version + id: get_version + run: echo "::set-output name=tag_version::${GITHUB_REF/refs\/tags\//}" + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 + with: + name: Perfin Release ${{steps.get_version.outputs.tag_version}} + + build_linux_deb: + needs: make_empty_release + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Setup JDK 21 + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: temurin + cache: maven + + - name: Install Maven 3.9.6 + run: | + wget https://downloads.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz + tar -xvf apache-maven-3.9.6-bin.tar.gz + sudo mv apache-maven-3.9.6 /usr/local/apache-maven + rm apache-maven-3.9.6-bin.tar.gz + sudo update-alternatives --install /usr/bin/mvn mvn /usr/local/apache-maven/bin/mvn 1 + + - name: Check versions + run: | + java -version + javac -version + mvn -version + + - name: Build Package + id: build_package + run: | + ./scripts/package-linux-deb.sh + asset=$(find -type f name "*.deb") + echo "Found asset: $asset" + echo "::set-output name=asset_file::$asset" + + - name: Add to Release + uses: actions/upload-release-asset@v1 diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index b4fd2dd..90995ae 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -33,3 +33,7 @@ jobs: - name: Test with Maven run: mvn -B verify --file pom.xml + + - name: Release If Tagged Main + if: github.ref_name === "main" + run: echo "Push to main!"