Skip to content

Commit

Permalink
feat: ci -> version
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-segning committed Nov 3, 2024
1 parent 2729246 commit f715d08
Showing 1 changed file with 15 additions and 25 deletions.
40 changes: 15 additions & 25 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ on:
- main

jobs:
version:
runs-on: ubuntu-latest
outputs:
package_version: ${{ steps.version.outputs.to_version }}
steps:
- uses: actions/checkout@v4
- id: package_version
run: echo ::set-output name=to_version::$(node package_version.js)

build:
runs-on: ubuntu-latest
if: github.event.head_commit.author.name != 'actions'
Expand All @@ -24,47 +33,28 @@ jobs:
name: standalone_keycloak_theme
path: build/*.jar

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@v2.1.0
id: step1
with:
action_name: is_package_json_version_upgraded

create_github_release:
runs-on: ubuntu-latest
needs:
- check_if_version_upgraded
- build
- version
# 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'
)
if: github.event_name == 'push'
steps:
- run: mkdir jars
- uses: actions/download-artifact@v4
with:
name: standalone_keycloak_theme
- run: mv *.jar jars/
- uses: softprops/action-gh-release@v1
- uses: softprops/action-gh-release@v2
with:
name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }}
tag_name: v${{ needs.check_if_version_upgraded.outputs.to_version }}
name: Release ${{ needs.version.outputs.package_version }}
tag_name: v${{ needs.version.outputs.package_version }}
target_commitish: ${{ github.head_ref || github.ref }}
generate_release_notes: true
files: |
jars/*.jar
draft: false
prerelease: ${{ needs.check_if_version_upgraded.outputs.is_release_beta == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit f715d08

Please sign in to comment.