mirror of https://github.com/jacekkow/keycloak-protocol-cas

github-actions
2024-10-24 9728128e602989c83dc254ae40a14db75d2cd040
.github/workflows/release.yml
@@ -5,6 +5,8 @@
name: Release
permissions: {}
jobs:
  build:
    name: Build
@@ -12,14 +14,14 @@
    steps:
      - id: checkout
        name: Checkout code
        uses: actions/checkout@v3
        uses: actions/checkout@v4
      - id: java
        name: Install Java and Maven
        uses: actions/setup-java@v3
        uses: actions/setup-java@v4
        with:
          distribution: zulu
          java-version: 11
          java-version: 17
      - id: vars
        name: Get project variables
@@ -38,7 +40,7 @@
          mvn -B test package
      - name: Upload artifact
        uses: actions/upload-artifact@v3
        uses: actions/upload-artifact@v4
        with:
          name: jar
          path: target/${{ steps.vars.outputs.artifactId }}-${{ steps.vars.outputs.projectVersion }}.jar
@@ -57,11 +59,11 @@
    steps:
      - id: checkout
        name: Checkout code
        uses: actions/checkout@v3
        uses: actions/checkout@v4
      - id: download_artifact
        name: Download artifact
        uses: actions/download-artifact@v3
        uses: actions/download-artifact@v4
        with:
          name: jar
@@ -108,31 +110,20 @@
    name: Release
    runs-on: ubuntu-latest
    needs: [build, test]
    permissions:
      contents: write
    steps:
      - id: download_artifact
        name: Download artifact
        uses: actions/download-artifact@v3
        uses: actions/download-artifact@v4
        with:
          name: jar
      - id: create_release
        name: Create release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        uses: softprops/action-gh-release@v2
        with:
          tag_name: ${{ github.ref }}
          release_name: ${{ needs.build.outputs.project_name }} ${{ needs.build.outputs.project_version }}
          draft: false
          prerelease: false
      - id: upload_release
        name: Upload release artifact
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ${{ needs.build.outputs.artifact_id }}-${{ needs.build.outputs.project_version }}.jar
          asset_name: ${{ needs.build.outputs.artifact_id }}-${{ needs.build.outputs.project_version }}.jar
          asset_content_type: application/java-archive
          name: ${{ needs.build.outputs.project_name }} ${{ needs.build.outputs.project_version }}
          files: ${{ needs.build.outputs.artifact_id }}-${{ needs.build.outputs.project_version }}.jar
          fail_on_unmatched_files: true
          generate_release_notes: true