Skip to content

Commit

Permalink
Commit 3 - gh-release step
Browse files Browse the repository at this point in the history
Signed-off-by: mposolda <[email protected]>
  • Loading branch information
mposolda committed Dec 9, 2024
1 parent 631fa22 commit 0880c64
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
gh-org: mposolda
branch: main
tag: nightly
set-versions: false
nightly: true
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
gh-org: mposolda # TODO:mposolda remove or update this
branch: ${{ github.ref_name }}
tag: ${{ inputs.version }}
set-versions: true
nightly: false
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
34 changes: 27 additions & 7 deletions .github/workflows/x-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
tag:
required: true
type: string
set-versions:
nightly:
required: true
type: boolean
secrets:
Expand All @@ -37,20 +37,18 @@ jobs:
echo "Github organization: ${{ inputs.gh-org }} " >> $GITHUB_STEP_SUMMARY
echo "Branch: ${{ inputs.branch }} " >> $GITHUB_STEP_SUMMARY
echo "Target tag: ${{ inputs.tag }} " >> $GITHUB_STEP_SUMMARY
echo "Set versions: ${{ inputs.set-versions }} " >> $GITHUB_STEP_SUMMARY
echo "Is nightly build: ${{ inputs.nightly }} " >> $GITHUB_STEP_SUMMARY
release-impl:
create-tags:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# repository: "${{ inputs.gh-org }}/keycloak-nodejs-connect"
# token: ${{ secrets.GH_TOKEN }}
ref: ${{ inputs.branch }}

- name: Create version commit
if: inputs.set-versions
if: ${{ !inputs.nightly }}
run: |
./set-version.sh ${{ inputs.tag }}
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand All @@ -63,10 +61,32 @@ jobs:
- name: Push changes
run: git push --force origin refs/tags/${{ inputs.tag }}

create-gh-releases:
runs-on: ubuntu-latest
needs: [create-tags]
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Check if release exists
id: release-exists
run: >
echo "release-exists=$(
if ( gh release view ${{ inputs.tag }} --repo ${{ inputs.gh-org }}/keycloak-nodejs-connect &> /dev/null ); then
echo 'true'
else
echo 'false'
fi
)" >> $GITHUB_ENV
- name: Create a release
if: env.release-exists == 'false'
run: gh release create ${{ inputs.tag }} --repo ${{ inputs.gh-org }}/keycloak-nodejs-connect --title ${{ inputs.tag }} --draft ${{ inputs.nightly && '--prerelease' || '' }}


show-output:
name: Show Output
runs-on: ubuntu-latest
needs: [release-impl]
needs: [create-tags,create-gh-releases]
steps:
- run: |
echo "https://github.com/${{ inputs.gh-org }}/keycloak-nodejs-connect/tree/${{ inputs.tag }} " >> $GITHUB_STEP_SUMMARY

0 comments on commit 0880c64

Please sign in to comment.