From d2ae0ed906ae15e75ad798c097b85ace764b44b7 Mon Sep 17 00:00:00 2001 From: iletai Date: Tue, 26 Mar 2024 09:09:51 +0700 Subject: [PATCH 1/6] Add modifier release --- .github/workflows/build.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3dfe961..d18d92d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -155,3 +155,18 @@ jobs: if [[ "${{ github.event.pull_request.user.login }}" == "${REPO_OWNER}" ]]; then gh pr merge ${{ github.event.number }} --squash --auto fi + createtaggithub: + name: Create Tag Release + needs: allowgithub + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Create Tag + if: success() && github.event.pull_request.user.login == github.repository_owner + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Create Tag + gh release create v${{ github.run_number }} --title "Release v${{ github.run_number }}" --notes "Release v${{ github.run_number }}" --prerelease + From 16d9edbcb613bd37ed0f60486e77fff45d6ae42a Mon Sep 17 00:00:00 2001 From: iletai Date: Tue, 26 Mar 2024 09:31:45 +0700 Subject: [PATCH 2/6] + Integration CICD --- .github/workflows/build.yml | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d18d92d..4a0bffc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,13 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - + - name: Cache Swift dependencies + uses: actions/cache@v4 + with: + path: .build + key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm- - name: Pull Request Checklist Checker uses: venkatsarvesh/pr-tasks-completed-action@v1.0.0 with: @@ -60,13 +66,6 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Cache Swift dependencies - uses: actions/cache@v4 - with: - path: .build - key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} - restore-keys: | - ${{ runner.os }}-spm- - name: Set Swift Version uses: swift-actions/setup-swift@v1 @@ -168,5 +167,15 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # Create Tag - gh release create v${{ github.run_number }} --title "Release v${{ github.run_number }}" --notes "Release v${{ github.run_number }}" --prerelease + # Fetch the latest tag + latest_tag=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name') + + # Extract the version number from the latest tag + version=$(echo $latest_tag | sed 's/v//') + + # Increment the version number + incremented_version=$(echo $version | awk -F. -v OFS=. '{$NF++; print}') + + # Create a new tag with the incremented version number + gh release create v$incremented_version --title "Release v$incremented_version" --notes "Release v$incremented_version" --prerelease From aa1dd0aefccc25c25226a76a7dd42cdf612dbbfb Mon Sep 17 00:00:00 2001 From: iletai Date: Tue, 26 Mar 2024 10:03:28 +0700 Subject: [PATCH 3/6] Add release config --- .github/workflows/build.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3eb76a..3f0955f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,13 +18,7 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Cache Swift dependencies - uses: actions/cache@v4 - with: - path: .build - key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} - restore-keys: | - ${{ runner.os }}-spm- + - name: Pull Request Checklist Checker uses: venkatsarvesh/pr-tasks-completed-action@v1.0.0 with: @@ -66,7 +60,13 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - + - name: Cache Swift dependencies + uses: actions/cache@v4 + with: + path: .build + key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm- - name: Set Swift Version uses: swift-actions/setup-swift@v1 with: @@ -161,6 +161,13 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 + - name: Build executable for release + env: + PRODUCT_NAME: ${{ secrets.PRODUCT_NAME }} + run: swift build -c release --arch arm64 --arch x86_64 --product ${PRODUCT_NAME} + - name: Compress archive + run: tar -czf ${{ github.ref_name }}.tar.gz -C + .build/apple/Products/Release ${PRODUCT_NAME}.swiftmodule - name: Create Tag if: success() && github.event.pull_request.user.login == github.repository_owner env: @@ -177,6 +184,5 @@ jobs: incremented_version=$(echo $version | awk -F. -v OFS=. '{$NF++; print}') # Create a new tag with the incremented version number - gh release create v$incremented_version --title "Release v$incremented_version" --notes "Release v$incremented_version" --prerelease - + gh release create v$incremented_version --title "Release v$incremented_version" --notes "Release v$incremented_version" --prerelease '${{ github.ref_name }}.tar.gz' From c544472c0f001a7b5d4a2d90ab2ffa15ae9ff12f Mon Sep 17 00:00:00 2001 From: iletai Date: Tue, 26 Mar 2024 10:16:29 +0700 Subject: [PATCH 4/6] + Integration CICD Release Only MacOS Build Env --- .github/workflows/build.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc2d4f7..2910d9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -157,7 +157,13 @@ jobs: createtaggithub: name: Create Tag Release needs: allowgithub - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-14 + swift: + - "5.9" steps: - name: Checkout Repository uses: actions/checkout@v4 From 7c46428c0e43bbadcd645dd39fe93a3cf899f38b Mon Sep 17 00:00:00 2001 From: iletai Date: Tue, 26 Mar 2024 10:27:59 +0700 Subject: [PATCH 5/6] + Integration CICD Release Only MacOS Build Env --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2910d9a..e7eff0e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -170,10 +170,10 @@ jobs: - name: Build executable for release env: PRODUCT_NAME: ${{ secrets.PRODUCT_NAME }} - run: swift build -c release --arch arm64 --arch x86_64 --product ${PRODUCT_NAME} + run: swift build -c release --arch arm64 --arch x86_64 --product ${{secrets.PRODUCT_NAME }} - name: Compress archive run: tar -czf ${{ github.ref_name }}.tar.gz -C - .build/apple/Products/Release ${PRODUCT_NAME}.swiftmodule + .build/apple/Products/Release ${{secrets.PRODUCT_NAME}}.swiftmodule - name: Create Tag if: success() && github.event.pull_request.user.login == github.repository_owner env: From 4f70fc0b7e467e5c141d6e4d197136d320ec28cd Mon Sep 17 00:00:00 2001 From: iletai Date: Tue, 26 Mar 2024 10:47:22 +0700 Subject: [PATCH 6/6] + Integration CICD Release Only MacOS Build Env --- .github/workflows/build.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e7eff0e..18f3d5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -170,11 +170,8 @@ jobs: - name: Build executable for release env: PRODUCT_NAME: ${{ secrets.PRODUCT_NAME }} - run: swift build -c release --arch arm64 --arch x86_64 --product ${{secrets.PRODUCT_NAME }} - - name: Compress archive - run: tar -czf ${{ github.ref_name }}.tar.gz -C - .build/apple/Products/Release ${{secrets.PRODUCT_NAME}}.swiftmodule - - name: Create Tag + run: swift build -c release --arch arm64 --arch x86_64 --product ${{ secrets.PRODUCT_NAME }} + - name: Create Tag And Zip File if: success() && github.event.pull_request.user.login == github.repository_owner env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -189,6 +186,10 @@ jobs: # Increment the version number incremented_version=$(echo $version | awk -F. -v OFS=. '{$NF++; print}') + # Create a tarball of the built product + tar -czf v$(echo {incremented_version}).tar.gz -C + .build/apple/Products/Release ${{secrets.PRODUCT_NAME}}.swiftmodule + # Create a new tag with the incremented version number gh release create v$incremented_version --title "Release v$incremented_version" --notes "Release v$incremented_version" --prerelease '${{ github.ref_name }}.tar.gz'