diff --git a/.github/workflows/prod-ci.yml b/.github/workflows/ci.yml similarity index 85% rename from .github/workflows/prod-ci.yml rename to .github/workflows/ci.yml index f215b66..d39288f 100644 --- a/.github/workflows/prod-ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,9 @@ -name: prod-CI +name: CI on: pull_request: - branches: [ "main" ] + branches: + - '*' jobs: build: @@ -10,7 +11,7 @@ jobs: steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true token: ${{ secrets.SUBMODULE_TOKEN }} diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml deleted file mode 100644 index b881487..0000000 --- a/.github/workflows/dev-ci.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: develop-CI - -on: - pull_request: - branches: [ "develop" ] - -jobs: - build: - runs-on: ubuntu-22.04 - - steps: - - name: checkout - uses: actions/checkout@v3 - with: - submodules: true - token: ${{ secrets.SUBMODULE_TOKEN }} - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'corretto' - java-version: '17' - - - name: build - run: | - chmod +x gradlew - ./gradlew build -x test - shell: bash \ No newline at end of file diff --git a/.github/workflows/prod-cd.yml b/.github/workflows/prod-cd.yml index 14df26f..1fbab71 100644 --- a/.github/workflows/prod-cd.yml +++ b/.github/workflows/prod-cd.yml @@ -9,10 +9,9 @@ jobs: env: working-directory: . - steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true token: ${{ secrets.SUBMODULE_TOKEN }} @@ -60,3 +59,33 @@ jobs: script: | cd ~ ./deploy.sh + + create-release: + needs: cd + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - name: 버전 정보 추출 + id: extract_version_name + run: | + VERSION=$(echo "${{ github.event.head_commit.message }}" | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -n1 | tr -d '[:space:]') + + if [ -z "$VERSION" ]; then + echo "No version found in the commit message." + exit 1 + fi + + - name: Create GitHub Release + run: | + response=$(curl -s -o /dev/null -w "%{http_code}" -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.SUBMODULE_TOKEN }}" \ + https://api.github.com/repos/OMZigak/KKUMER/releases \ + -d '{"tag_name":"${{ steps.extract_version_name.outputs.version }}","target_commitish":"main","name":"${{ steps.extract_version_name.outputs.version }}","generate_release_notes":true}') + + if [ "$response" -ne 201 ]; then + echo "GitHub Release failed with status code $response" + exit 1 + fi \ No newline at end of file