diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..f40af695 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,26 @@ +name: Nightly Release + +on: + push: + branches: + - main + +jobs: + delete_tag: + runs-on: ubuntu-latest + steps: + - name: Delete release + uses: dev-drprasad/delete-tag-and-release@v0.2.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + delete_release: true + tag_name: 0.0.0-SNAPSHOT + nightly: + needs: delete_tag + uses: CheckmarxDev/ast-cli-java-wrapper/.github/workflows/release.yml@main + with: + tag: "0.0.0-SNAPSHOT" + dev: false + cliTag: "2.0.0-nightly" + secrets: inherit diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml deleted file mode 100644 index 46cc7f0c..00000000 --- a/.github/workflows/release-dev.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Dev Release Creation - -on: - workflow_dispatch: - inputs: - tag: - description: 'Dev release tag' - required: true - type: string - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - - - name: Tag - run: | - echo ${{ inputs.tag }} - echo "NEXT_VERSION=${{ inputs.tag }}" >> $GITHUB_ENV - tag=${{ inputs.tag }} - message='${{ inputs.tag }}' - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - git tag -a "${tag}" -m "${message}" - - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - - name: Echo env - run: echo ${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 19668ab7..774cbfca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,36 @@ name: Release Creation on: - push: - tags: - - "*" + workflow_dispatch: + inputs: + tag: + description: 'Dev release tag' + required: true + type: string + dev: + description: 'Is dev build' + required: false + default: true + type: boolean + cliTag: + description: 'Version of the CLI to bundle' + required: true + type: string + workflow_call: + inputs: + tag: + description: 'Dev release tag' + required: true + type: string + dev: + description: 'Is dev build' + required: false + default: true + type: boolean + cliTag: + description: 'Version of the CLI to bundle' + required: true + type: string jobs: release: @@ -14,8 +41,16 @@ jobs: with: token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Tag + run: | + echo ${{ inputs.tag }} + tag=${{ inputs.tag }} + echo "RELEASE_VERSION=${{ inputs.tag }}" >> $GITHUB_ENV + message='${{ inputs.tag }}' + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git tag -a "${tag}" -m "${message}" + git push origin "${tag}" - name: Cache local Maven repository uses: actions/cache@v3 @@ -39,8 +74,16 @@ jobs: - name: Update the POM version. run: mvn -B versions:set -DnewVersion='${{ env.RELEASE_VERSION }}' --file pom.xml -DskipTests + - name: Build artifactId property + run: | + prop='' + if [ ${{ inputs.dev }} = true ]; then + prop='-Dast.wrapper.id=ast-cli-java-wrapper-dev' + fi + echo "AID_PROP=${prop}" >> $GITHUB_ENV + - name: Publish package - run: mvn --batch-mode deploy -DskipTests + run: mvn --batch-mode deploy -DskipTests ${{ env.AID_PROP }} env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}