From 66efc5c4ee6b34cee9fa6f6224de744a3aa1c2f0 Mon Sep 17 00:00:00 2001 From: selmankoc Date: Fri, 16 Jun 2023 11:41:31 +0300 Subject: [PATCH 1/4] fix github token --- .github/workflows/update-versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-versions.yml b/.github/workflows/update-versions.yml index 386b6858b9..d0a295884f 100644 --- a/.github/workflows/update-versions.yml +++ b/.github/workflows/update-versions.yml @@ -28,6 +28,6 @@ jobs: - name: Update latest-versions.json and create PR env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} run: | python .github/scripts/update_versions.py From 1340bcfa75af81af96c132db93b0e51509764327 Mon Sep 17 00:00:00 2001 From: selmankoc Date: Fri, 16 Jun 2023 11:47:56 +0300 Subject: [PATCH 2/4] Create trigger-release.ps1 --- .github/scripts/trigger-release.ps1 | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/scripts/trigger-release.ps1 diff --git a/.github/scripts/trigger-release.ps1 b/.github/scripts/trigger-release.ps1 new file mode 100644 index 0000000000..9aae8f3ea9 --- /dev/null +++ b/.github/scripts/trigger-release.ps1 @@ -0,0 +1,30 @@ +param( + [string]$tag_name, + [string]$prerelease, + [string]$branchName +) + +# GitHub credentials and repository info +$user = "skoc10" +$repo = "my_projects" +$workflow_file_name = "publish-release.yml" +$token = $env:RELEASE_TOKEN + +# Create a header for the API request +$headers = @{ + Authorization = "Bearer $token" + Accept = "application/vnd.github.v3+json" +} + +# Create a body for the API request +$body = @{ + ref = $branchName + inputs = @{ + tag_name = $tag_name + prerelease = $prerelease + branchName = $branchName + } +} | ConvertTo-Json + +# Send the API request to GitHub +Invoke-RestMethod -Method Post -Headers $headers -Body $body -Uri "https://api.github.com/repos/$user/$repo/actions/workflows/$workflow_file_name/dispatches" From 76f4949bd3b2e7c6031a43a1d740c4a87a75cb9f Mon Sep 17 00:00:00 2001 From: selmankoc Date: Fri, 16 Jun 2023 11:47:59 +0300 Subject: [PATCH 3/4] Create publish-release.yml --- .github/workflows/publish-release.yml | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/publish-release.yml diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000000..b929fa6d3c --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,44 @@ +name: Create Release + +on: + workflow_dispatch: + inputs: + tag_name: + description: 'Tag Name' + required: true + prerelease: + description: 'Pre-release?' + required: true + branchName: + description: 'Branch Name' + required: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.branchName }} + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + with: + tag_name: ${{ github.event.inputs.tag_name }} + release_name: ${{ github.event.inputs.tag_name }} + draft: false + prerelease: ${{ github.event.inputs.prerelease }} + + - name: Checkout code at tag + uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.tag_name }} + + - name: Build Project + run: | + # add your build commands here, depending on your project's requirements. + echo "Build project here" From f2bb91e62a67d7c458803761e6b47d42035d55eb Mon Sep 17 00:00:00 2001 From: selmankoc Date: Fri, 16 Jun 2023 14:03:16 +0300 Subject: [PATCH 4/4] Delete trigger-release.ps1 --- .github/scripts/trigger-release.ps1 | 30 ----------------------------- 1 file changed, 30 deletions(-) delete mode 100644 .github/scripts/trigger-release.ps1 diff --git a/.github/scripts/trigger-release.ps1 b/.github/scripts/trigger-release.ps1 deleted file mode 100644 index 9aae8f3ea9..0000000000 --- a/.github/scripts/trigger-release.ps1 +++ /dev/null @@ -1,30 +0,0 @@ -param( - [string]$tag_name, - [string]$prerelease, - [string]$branchName -) - -# GitHub credentials and repository info -$user = "skoc10" -$repo = "my_projects" -$workflow_file_name = "publish-release.yml" -$token = $env:RELEASE_TOKEN - -# Create a header for the API request -$headers = @{ - Authorization = "Bearer $token" - Accept = "application/vnd.github.v3+json" -} - -# Create a body for the API request -$body = @{ - ref = $branchName - inputs = @{ - tag_name = $tag_name - prerelease = $prerelease - branchName = $branchName - } -} | ConvertTo-Json - -# Send the API request to GitHub -Invoke-RestMethod -Method Post -Headers $headers -Body $body -Uri "https://api.github.com/repos/$user/$repo/actions/workflows/$workflow_file_name/dispatches"