From b493cecf4de7923281868b81f1a1fbf07c1b3d9e 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 | 142 +++++++++++++++++++++++------------ package.json | 2 +- web/.github/workflows/ci.yml | 6 +- 3 files changed, 97 insertions(+), 53 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a5927a8c..3ac85326 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,12 +51,56 @@ 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: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20" + - uses: bahmutov/npm-install@v1 + - name: Build back + run: cd api && yarn build + - 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 needs: - check_if_version_upgraded - create_tag + - pre-release steps: - uses: actions/checkout@v4 - uses: docker/setup-qemu-action@v3 @@ -131,52 +175,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..cf236e78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sill", - "version": "1.42.7", + "version": "1.42.11", "license": "MIT", "private": true, "scripts": { diff --git a/web/.github/workflows/ci.yml b/web/.github/workflows/ci.yml index ad57f627..e927fbad 100644 --- a/web/.github/workflows/ci.yml +++ b/web/.github/workflows/ci.yml @@ -46,11 +46,11 @@ jobs: - uses: actions/setup-node@v2 - uses: bahmutov/npm-install@v1 - run: yarn build - - run: npx keycloakify + - run: cd web && npx keycloakify && cd .. env: XDG_CACHE_HOME: "/home/runner/.cache/yarn" - - run: mv build_keycloak/target/retrocompat-*.jar retrocompat-keycloak-theme.jar - - run: mv build_keycloak/target/*.jar keycloak-theme.jar + - run: mv web/build_keycloak/target/retrocompat-*.jar retrocompat-keycloak-theme.jar + - run: mv web/build_keycloak/target/*.jar keycloak-theme.jar - uses: softprops/action-gh-release@v1 with: name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }}