Skip to content

Commit

Permalink
create pre-release when deploying a new version on main
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeBu committed Apr 10, 2024
1 parent a61c575 commit b493cec
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 53 deletions.
142 changes: 93 additions & 49 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}`})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sill",
"version": "1.42.7",
"version": "1.42.11",
"license": "MIT",
"private": true,
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions web/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit b493cec

Please sign in to comment.