From 44251d7ec054e6d44f05748258e0e1bdb8f6aa60 Mon Sep 17 00:00:00 2001 From: Helmut Wolf Date: Thu, 25 Jul 2024 11:36:13 +0200 Subject: [PATCH] CI --- .github/workflows/ci.yaml | 84 +++++++++++---------------------------- 1 file changed, 23 insertions(+), 61 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 641d957..febe82b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,70 +6,32 @@ on: pull_request: branches: - main +env: + ARTIFACT_NAME: keycloak-theme-world-direct.jar -jobs: +defaults: + run: + working-directory: ./src +jobs: build: runs-on: ubuntu-latest if: github.event.head_commit.author.name != 'actions' steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2.1.3 - with: - node-version: '16' - - uses: bahmutov/npm-install@v1 - - run: yarn build - - run: npx keycloakify - - uses: actions/upload-artifact@v2 - with: - name: keycloak-theme-world-direct - path: build_keycloak/target/*keycloak-theme*.jar - - uses: actions/upload-artifact@v2 - with: - name: build - path: build - - check_if_version_upgraded: - name: Check if version upgrade - runs-on: ubuntu-latest - needs: build - outputs: - from_version: ${{ steps.step1.outputs.from_version }} - to_version: ${{ steps.step1.outputs.to_version }} - is_upgraded_version: ${{ steps.step1.outputs.is_upgraded_version }} - steps: - - uses: garronej/ts-ci@v1.1.7 - id: step1 - with: - action_name: is_package_json_version_upgraded - - create_github_release: - runs-on: ubuntu-latest - needs: - - check_if_version_upgraded - # We create a release only if the version have been upgraded and we are on a default branch - # PR on the default branch can release beta but not real release - if: | - needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true' && - ( - github.event_name == 'push' || - needs.check_if_version_upgraded.outputs.is_release_beta == 'true' - ) - steps: - - run: mkdir jars - - uses: actions/download-artifact@v2 - with: - name: keycloak-theme-world-direct - - run: mv *keycloak-theme*.jar jars/keycloak-theme-world-direct.jar - - uses: softprops/action-gh-release@v1 - with: - name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }} - tag_name: v${{ needs.check_if_version_upgraded.outputs.to_version }} - target_commitish: ${{ github.head_ref || github.ref }} - generate_release_notes: true - files: | - jars/keycloak-theme-world-direct.jar - draft: false - prerelease: ${{ needs.check_if_version_upgraded.outputs.is_release_beta == 'true' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + - uses: actions/checkout@v4 + - name: Create jar artifact + run: | + zip -r $ARTIFACT_NAME * + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: keycloak-theme + path: src/$ARTIFACT_NAME + - name: Create Release when we a tag ref has been created + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + generate_release_notes: true + files: | + $ARTIFACT_NAME + draft: true