From 53fb89dfda058fcb69c6137cd7c816d49d4c0456 Mon Sep 17 00:00:00 2001 From: "~ . ~" Date: Fri, 4 Oct 2024 14:36:04 -0400 Subject: [PATCH] Create release-assembly.yml --- .github/workflows/release-assembly.yml | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/release-assembly.yml diff --git a/.github/workflows/release-assembly.yml b/.github/workflows/release-assembly.yml new file mode 100644 index 0000000..af970d1 --- /dev/null +++ b/.github/workflows/release-assembly.yml @@ -0,0 +1,57 @@ +name: Release Assembly + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +jobs: + build-and-release: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + + - name: Build with Maven + run: mvn clean package + + - name: Get version + id: get_version + run: | + if [[ $GITHUB_REF == refs/tags/v* ]]; then + echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + else + echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT + fi + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.get_version.outputs.VERSION }} + release_name: Release ${{ steps.get_version.outputs.VERSION }} + draft: false + prerelease: false + + - name: 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: ./target/server-${{ steps.get_version.outputs.VERSION }}-bin.zip + asset_name: oscal-server-${{ steps.get_version.outputs.VERSION }}.zip + asset_content_type: application/zip \ No newline at end of file