From bb7229189b6a921cf248f355158cbc5a7377e6b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Burkard?= <22095555+JeromeBu@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:02:54 +0200 Subject: [PATCH] create pre-release when deploying a new version on main --- .github/workflows/ci.yaml | 134 ++++++++++++++++++++++++-------------- package.json | 2 +- 2 files changed, 86 insertions(+), 50 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a5927a8c..470f72a6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,6 +51,42 @@ jobs: git config --local user.name "GitHub Actions" git tag -a v${{ needs.check_if_version_upgraded.outputs.to_version }} -m "Deployment tag for v${{ needs.check_if_version_upgraded.outputs.to_version }}" git push --tags + + + pre-release: + runs-on: ubuntu-latest + needs: + - check_if_version_upgraded + - create_tag + env: + TO_VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }} + steps: + - name: Keycloakify + run: npx keycloakify + env: + XDG_CACHE_HOME: "/home/runner/.cache/yarn" + - name: Get tag of latest release + id: get-latest-release-tag + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const latestRelease = await github.request(`GET /repos/${{ github.repository }}/releases/latest`) + return latestRelease.data.tag_name + result-encoding: string + - name: "Generate release candidate on github" + uses: softprops/action-gh-release@v2 + with: + name: Release candidate v${{ env.TO_VERSION }}-rc + prerelease: true + tag_name: v${{ env.TO_VERSION }}-rc + target_commitish: ${{ steps.get-latest-release-tag.outputs.name }} + generate_release_notes: true + files: | + retrocompat-keycloak-theme.jar + keycloak-theme.jar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} docker: runs-on: ubuntu-latest @@ -131,52 +167,52 @@ jobs: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} -# create_github_release: -# name: "Create release notes" -# runs-on: ubuntu-latest -# needs: -# - trigger_production_deploy -# - check_if_version_upgraded -# - create_tag -# 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' -# ) -## We create a release only when all of the above are validated: -## - we are on default branch -## - version has been upgraded -## - we push to production -# env: -# TO_VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }} -# steps: -# - name: Get tag of latest release -# id: get-latest-release-tag -# uses: actions/github-script@v7 -# with: -# github-token: ${{ secrets.GITHUB_TOKEN }} -# script: | -# const latestRelease = await github.request(`GET /repos/${{ github.repository }}/releases/latest`) -# return latestRelease.data.tag_name -# result-encoding: string -# - name: Generate release notes content from latest release -# id: generate-release-notes -# uses: actions/github-script@v7 -# with: -# github-token: ${{ secrets.GITHUB_TOKEN }} -# script: | -# const releaseNotes = await github.request(`POST /repos/${{ github.repository }}/releases/generate-notes`, { -# tag_name: `v${{ env.TO_VERSION }}`, -# previous_tag_name: `${{steps.get-latest-release-tag.outputs.result}}` }) -# core.setOutput("name", releaseNotes.data.name); -# core.setOutput("body", releaseNotes.data.body); -# - name: Create release notes on github -# uses: actions/github-script@v7 -# with: -# github-token: ${{ secrets.GITHUB_TOKEN }} -# script: | -# await github.request(`POST /repos/${{ github.repository }}/releases`, { -# tag_name: `v${{ env.TO_VERSION }}`, -# name: `${{ steps.generate-release-notes.outputs.name }}`, -# body: `${{ steps.generate-release-notes.outputs.body }}`}) + create_github_release: + name: "Create release notes" + runs-on: ubuntu-latest + needs: + - trigger_production_deploy + - check_if_version_upgraded + - create_tag + 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' + ) +# We create a release only when all of the above are validated: +# - we are on default branch +# - version has been upgraded +# - we have pushed to production + env: + TO_VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }} + steps: + - name: Get tag of latest release + id: get-latest-release-tag + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const latestRelease = await github.request(`GET /repos/${{ github.repository }}/releases/latest`) + return latestRelease.data.tag_name + result-encoding: string + - name: Generate release notes content from latest release + id: generate-release-notes + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const releaseNotes = await github.request(`POST /repos/${{ github.repository }}/releases/generate-notes`, { + tag_name: `v${{ env.TO_VERSION }}`, + previous_tag_name: `${{steps.get-latest-release-tag.outputs.result}}` }) + core.setOutput("name", releaseNotes.data.name); + core.setOutput("body", releaseNotes.data.body); + - name: Create release notes on github + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + await github.request(`POST /repos/${{ github.repository }}/releases`, { + tag_name: `v${{ env.TO_VERSION }}`, + name: `${{ steps.generate-release-notes.outputs.name }}`, + body: `${{ steps.generate-release-notes.outputs.body }}`}) diff --git a/package.json b/package.json index 4b3bc442..50ad9ea2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sill", - "version": "1.42.7", + "version": "1.42.9", "license": "MIT", "private": true, "scripts": {