diff --git a/.github/scripts/osc-api-check.sh b/.github/scripts/osc-api-check.sh
deleted file mode 100755
index 6c768a55..00000000
--- a/.github/scripts/osc-api-check.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/env bash
-set -e
-
-root=$(cd "$(dirname $0)/../.." && pwd)
-if [ -e "$root/.auto-release-abort" ]; then
- echo "previous step triggered stop, abort"
- exit 0
-fi
-github_url="https://api.github.com/repos/outscale/osc-api/releases"
-
-if [ -z "$GH_TOKEN" ]; then
- echo "GH_TOKEN is missing, abort."
- exit 1
-fi
-
-osc_api_last_release=$(curl -s -H "Authorization: token $GH_TOKEN" $github_url | jq ".[] | select(.prerelease == false) | select(.draft == false) | .tag_name" | sort -r --version-sort | head -n 1 | cut -f 2 -d '"')
-local_api_version=$(cat $root/api_version)
-
-echo "last API version used: $local_api_version"
-echo "last available version: $osc_api_last_release"
-
-if [[ "$local_api_version" = "$osc_api_last_release" ]]; then
- echo "no update needed, exiting"
- touch "$root/.auto-release-abort"
- exit 0
-fi
-
-echo "$osc_api_last_release" > $root/api_version
diff --git a/.github/scripts/release-build.sh b/.github/scripts/release-build.sh
index 375d043c..3ddb113e 100755
--- a/.github/scripts/release-build.sh
+++ b/.github/scripts/release-build.sh
@@ -2,10 +2,7 @@
set -e
root=$(cd "$(dirname $0)/../.." && pwd)
-if [ -e "$root/.auto-release-abort" ]; then
- echo "previous step triggered stop, abort"
- exit 0
-fi
+
# build new version number
local_sdk_version=$(cat $root/sdk_version)
local_sdk_version_major=$(echo $local_sdk_version | cut -d '.' -f 1)
@@ -13,28 +10,10 @@ local_sdk_version_minor=$(echo $local_sdk_version | cut -d '.' -f 2)
new_sdk_version_minor=$(( local_sdk_version_minor + 1 ))
new_sdk_version="$local_sdk_version_major.$new_sdk_version_minor.0"
-branch_name="autobuild-$new_sdk_version"
-git branch -m $branch_name
-
echo "$new_sdk_version" > $root/sdk_version
-# build release notes
-new_api_version=$(cat $root/api_version)
-release_notes="# $new_sdk_version
-
- - SDK update for Outscale API v$new_api_version
-
-"
-echo "$release_notes$(cat $root/changelog.md)" > $root/changelog.md
-
# generate SDK
cd "$root"
-sed -i "s|.*|${new_api_version}|" pom.xml
-# setup git && commit
-git config user.name "Outscale Bot"
-git config user.email "opensource+bot@outscale.com"
-for f in src dist pom.xml; do
- git add $f || true
-done
-git commit -asm "osc-sdk-java v$new_sdk_version"
+new_api_version=$(cat $root/api_version)
+sed -i "s|.*|${new_api_version}|" pom.xml
diff --git a/.github/scripts/release-check-duplicate.sh b/.github/scripts/release-check-duplicate.sh
deleted file mode 100755
index 452270a0..00000000
--- a/.github/scripts/release-check-duplicate.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/env bash
-set -e
-
-root=$(cd "$(dirname $0)/../.." && pwd)
-if [ -e "$root/.auto-release-abort" ]; then
- echo "previous step triggered stop, abort"
- exit 0
-fi
-# build new version number
-local_sdk_version=$(cat $root/sdk_version)
-local_sdk_version_major=$(echo $local_sdk_version | cut -d '.' -f 1)
-local_sdk_version_minor=$(echo $local_sdk_version | cut -d '.' -f 2)
-new_sdk_version_minor=$(( local_sdk_version_minor + 1 ))
-new_sdk_version="$local_sdk_version_major.$new_sdk_version_minor.0"
-
-branch_name="autobuild-$new_sdk_version"
-
-if [ -z "$GH_TOKEN" ]; then
- echo "GH_TOKEN is missing, abort."
- exit 1
-fi
-
-result=$(curl -s -H "Authorization: token $GH_TOKEN" "https://api.github.com/repos/outscale/osc-sdk-java/pulls" | jq ".[] | select(.title == \"SDK v$new_sdk_version\") | .title")
-
-if [ ! -z "$result" ]; then
- echo "Pull request seems to alread exist, abort."
- touch "$root/.auto-release-abort"
- exit 0
-fi
diff --git a/.github/scripts/release-pr.sh b/.github/scripts/release-pr.sh
deleted file mode 100755
index 96cf897d..00000000
--- a/.github/scripts/release-pr.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/env bash
-set -e
-
-root=$(cd "$(dirname $0)/../.." && pwd)
-if [ -e "$root/.auto-release-abort" ]; then
- echo "previous step triggered stop, abort"
- exit 0
-fi
-new_sdk_version=$(cat $root/sdk_version)
-branch_name="autobuild-$new_sdk_version"
-osc_api_version="$(cat $root/api_version)"
-
-if [ -z "$GH_TOKEN" ]; then
- echo "GH_TOKEN is missing, abort."
- exit 1
-fi
-
-# https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls#create-a-pull-request
-result=$(curl -s -X POST -H "Authorization: token $GH_TOKEN" -d "{\"head\":\"$branch_name\",\"base\":\"main\",\"title\":\"SDK v$new_sdk_version\",\"body\":\"Automatic build of SDK v$new_sdk_version version based on Outscale API v$osc_api_version\"}" "https://api.github.com/repos/outscale/osc-sdk-java/pulls")
-
-errors=$(echo $result | jq .errors)
-
-if [ "$errors" != "null" ]; then
- echo $errors
- echo "errors while creating pull request, abort."
- exit 1
-fi
diff --git a/.github/scripts/release-push.sh b/.github/scripts/release-push.sh
deleted file mode 100755
index 57f71e20..00000000
--- a/.github/scripts/release-push.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/env bash
-set -e
-
-root=$(cd "$(dirname $0)/../.." && pwd)
-if [ -e "$root/.auto-release-abort" ]; then
- echo "previous step triggered stop, abort"
- exit 0
-fi
-new_sdk_version=$(cat $root/sdk_version)
-branch_name="autobuild-$new_sdk_version"
-
-if [ -z "$SSH_PRIVATE_KEY" ]; then
- echo "SSH_PRIVATE_KEY is missing, abort."
- exit 1
-fi
-
-echo "$SSH_PRIVATE_KEY" > $root/bot.key
-GIT_SSH_COMMAND="ssh -i $root/bot.key" git push -f origin $branch_name
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 46f3f57d..821d3212 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -8,6 +8,8 @@ on:
permissions:
contents: write
+ pull-requests: write
+ id-token: write
jobs:
auto-build:
@@ -15,8 +17,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- with:
- ref: main
+ - uses: chainguard-dev/actions/setup-gitsign@main
- uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5
with:
distribution: 'temurin'
@@ -25,18 +26,24 @@ jobs:
- name: Write Outscale API version to use
run: echo "${{ github.event.inputs.api_version }}" > api_version
- - name: check for release duplicate
- env:
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
- run: make release-check-duplicate
-
- name: auto-generate release
run: make release-build
- - name: push release branch
- run: make release-push
- env:
- SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
- - name: create pull request
- run: make release-pr
+
+ - name: Get SDK version
+ id: get-sdk-version
+ run: |
+ echo "sdk_version=$(cat ./sdk_version)" >> "$GITHUB_OUTPUT"
+ - name: Create Pull Request
+ uses: peter-evans/create-pull-request@v8.1.0
+ with:
+ committer: "Outscale Bot "
+ author: "Outscale Bot "
+ commit-message: "🔖 release: osc-sdk-java v${{ env.sdk_version }}"
+ body: |
+ Automatic build of SDK v${{ env.sdk_version }} version based on Outscale API ${{ env.api_version }}.
+ title: "SDK v${{ env.sdk_version }}"
+ token: "${{ env.token }}"
env:
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
+ sdk_version: ${{ steps.get-sdk-version.outputs.sdk_version }}
+ api_version: ${{ github.event.inputs.api_version }}
+ token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
diff --git a/Makefile b/Makefile
index fc14d74a..39c37c66 100644
--- a/Makefile
+++ b/Makefile
@@ -77,26 +77,10 @@ auto-release: auto-release-cleanup osc-api-check release-check-duplicate release
auto-release-cleanup:
rm -rf .auto-release-abort || true
-.PHONY: osc-api-check
-osc-api-check:
- bash .github/scripts/osc-api-check.sh
-
-.PHONY: release-check-duplicate
-release-check-duplicate:
- bash .github/scripts/release-check-duplicate.sh
-
.PHONY: release-build
release-build:
bash .github/scripts/release-build.sh
-.PHONY: release-push
-release-push:
- bash .github/scripts/release-push.sh
-
-.PHONY: release-pr
-release-pr:
- bash .github/scripts/release-pr.sh
-
.PHONY: local-deploy
local-deploy:
mvn clean install -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dgpg.skip
diff --git a/sdk/pom.xml b/sdk/pom.xml
index e3d4d72e..283e018f 100644
--- a/sdk/pom.xml
+++ b/sdk/pom.xml
@@ -233,7 +233,7 @@
github.com
outscale
osc-sdk-java
- https://raw.githubusercontent.com/outscale/osc-api-deploy/refs/tags/v${outscale-api-version}/outscale.yaml
+ https://raw.githubusercontent.com/outscale/osc-api-deploy/refs/tags/${outscale-api-version}/outscale.yaml
java
templates
io.github.outscale