-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:mission-apprentissage/tjp-pilota…
…ge into feat/formations-specifiques
- Loading branch information
Showing
24 changed files
with
381 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# Check if an argument is provided | ||
if [[ $# -lt 1 ]]; then | ||
echo "Error: No arguments provided." | ||
echo "Usage: Provide 'patch', 'minor', or 'major' as the first argument." | ||
exit 1 | ||
fi | ||
|
||
readonly RC_TYPE=$1 | ||
|
||
case $RC_TYPE in | ||
patch|minor|major) | ||
;; | ||
*) | ||
echo "Invalid argument: $RC_TYPE" | ||
echo "Usage: Provide 'patch', 'minor', or 'major' as the first argument." | ||
exit 1 | ||
;; | ||
esac | ||
|
||
readonly VERSION=$("${ROOT_DIR}/.bin/scripts/get-version.sh") | ||
|
||
generate_next_version() { | ||
local last_current_branch_tag=$(git describe --tags --abbrev=0 --match="v[0-9]*.[0-9]*.[0-9]*") | ||
local remote_tags=$(git ls-remote --tags origin | awk '{print $2}' | sed 's|refs/tags/||') | ||
local current_commit_id=$(git rev-parse HEAD) | ||
local current_version_commit_id=$(git rev-list -n 1 $VERSION 2> /dev/null) | ||
|
||
if [ "$current_commit_id" == "$current_version_commit_id" ]; then | ||
echo $VERSION; | ||
return | ||
fi; | ||
|
||
local version=${last_current_branch_tag#v} | ||
|
||
if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+).*$ ]]; then | ||
major="${BASH_REMATCH[1]}" | ||
minor="${BASH_REMATCH[2]}" | ||
patch="${BASH_REMATCH[3]}" | ||
else | ||
echo "Invalid version format $version" | ||
exit 1 | ||
fi | ||
|
||
case $RC_TYPE in | ||
major) | ||
((major++)) | ||
minor=0 | ||
patch=0 | ||
;; | ||
minor) | ||
((minor++)) | ||
patch=0 | ||
;; | ||
patch) | ||
((patch++)) | ||
;; | ||
*) | ||
echo "Error: Invalid bump type. Use 'patch', 'minor', or 'major'." | ||
exit 1 | ||
;; | ||
esac | ||
|
||
manual_version="$major.$minor.$patch" | ||
echo $manual_version | ||
} | ||
|
||
echo $(generate_next_version "$@") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
|
||
# Check if an argument is provided | ||
if [[ $# -lt 1 ]]; then | ||
echo "Error: No arguments provided." | ||
echo "Usage: Provide 'patch', 'minor', or 'major' as the first argument." | ||
exit 1 | ||
fi | ||
|
||
readonly RC_TYPE=$1 | ||
|
||
case $RC_TYPE in | ||
patch|minor|major) | ||
;; | ||
*) | ||
echo "Invalid argument: $RC_TYPE" | ||
echo "Usage: Provide 'patch', 'minor', or 'major' as the first argument." | ||
exit 1 | ||
;; | ||
esac | ||
|
||
readonly VERSION=$("${ROOT_DIR}/.bin/scripts/get-version.sh") | ||
NEXT_VERSION=$("$ROOT_DIR/.bin/scripts/generate-manual-label.sh" "$@") | ||
|
||
echo "Creating release : $NEXT_VERSION" | ||
|
||
echo "Création des images docker locales (docker build)" | ||
|
||
echo "Build $NEXT_VERSION ..." | ||
"$ROOT_DIR/.bin/scripts/release-app.sh" $NEXT_VERSION push | ||
git tag -f "v$NEXT_VERSION" | ||
git push -f origin "v$NEXT_VERSION" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
name: Release candidate | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_type: | ||
description: Le type de Release Candidate à générer | ||
type: choice | ||
required: true | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
|
||
workflow_call: | ||
inputs: | ||
release_type: | ||
description: Le type de Release Candidate à générer | ||
type: string | ||
required: false | ||
|
||
secrets: | ||
DEPLOY_SSH_PRIVATE_KEY: | ||
description: SSH private key | ||
required: true | ||
DEPLOY_PASS: | ||
description: SSH PWD TO DEPLOY | ||
required: true | ||
SLACK_WEBHOOK: | ||
description: Slack webhook URL | ||
required: true | ||
VAULT_PWD: | ||
description: Vault Password | ||
required: true | ||
|
||
jobs: | ||
tests: | ||
uses: "./.github/workflows/ci.yml" | ||
|
||
release: | ||
concurrency: | ||
group: "release-${{ github.workflow }}-${{ github.ref }}" | ||
permissions: write-all | ||
outputs: | ||
VERSION: ${{ steps.get-version.outputs.VERSION }} | ||
PREV_VERSION: ${{ steps.get-prev-version.outputs.VERSION }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: true | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
**/node_modules | ||
.yarn/install-state.gz | ||
.yarn/cache | ||
key: yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: yarn- | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
platforms: linux/amd64 | ||
install: true | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Expose GitHub Runtime | ||
uses: crazy-max/ghaction-github-runtime@v2 | ||
|
||
- name: Retrieve previous version | ||
id: get-prev-version | ||
run: echo "VERSION=$(git describe --tags --abbrev=0 | cut -c2-)" >> "$GITHUB_OUTPUT" | ||
|
||
- name: bump and release | ||
run: yarn release:candidate ${{ inputs.release_type }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
GITHUB_REF_NAME: ${{ env.GITHUB_REF_NAME }} | ||
|
||
- name: Retrieve new version | ||
id: get-version | ||
run: echo "VERSION=$(git describe --tags --abbrev=0 | cut -c2-)" >> "$GITHUB_OUTPUT" | ||
|
||
docker-scout: | ||
if: needs.release.outputs.VERSION != needs.release.outputs.PREV_VERSION && needs.release.outputs.PREV_VERSION != '' | ||
concurrency: | ||
group: "scout-${{ github.workflow }}-${{ github.ref }}" | ||
needs: ["release"] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Authenticate to Docker | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USER }} | ||
password: ${{ secrets.DOCKER_PAT }} | ||
|
||
- name: Server Docker Scout | ||
uses: docker/scout-action@v1 | ||
with: | ||
command: quickview,cves,recommendations,compare | ||
image: ghcr.io/mission-apprentissage/ij_orion_server:${{ needs.release.outputs.VERSION }} | ||
to: ghcr.io/mission-apprentissage/ij_orion_server:${{ needs.release.outputs.PREV_VERSION }} | ||
sarif-file: sarif-server.output.json | ||
|
||
- name: Server Docker Upload SARIF result | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: sarif-server.output.json | ||
category: Docker Server | ||
|
||
- name: UI Docker Scout | ||
uses: docker/scout-action@v1 | ||
with: | ||
command: quickview,cves,recommendations,compare | ||
image: ghcr.io/mission-apprentissage/ij_orion_ui:${{ needs.release.outputs.VERSION }}-production | ||
to: ghcr.io/mission-apprentissage/ij_orion_ui:${{ needs.release.outputs.PREV_VERSION }}-production | ||
sarif-file: sarif-ui.output.json | ||
|
||
- name: UI Docker Upload SARIF result | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: sarif-ui.output.json | ||
category: Docker UI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.