Skip to content

Commit

Permalink
Add release publish on releaser
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <marrcooos@gmail.com>
  • Loading branch information
mcandeia committed Aug 29, 2024
1 parent 5256237 commit caa6694
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions .github/workflows/releaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ on:
branches:
- main

permissions:
contents: write # Allows pushing changes and creating tags
pull-requests: write # Allows adding comments to pull requests
issues: write
permissions: write-all

jobs:
tag-discussion:
Expand Down Expand Up @@ -152,3 +149,28 @@ jobs:
run: |
git tag ${{ steps.determine_version.outputs.new_version }}
git push origin ${{ steps.determine_version.outputs.new_version }}
- name: "Create release"
if: steps.determine_version.outputs.new_version != ''
uses: "actions/github-script@v6"
env:
RELEASE_TAG: ${{ steps.determine_version.outputs.new_version }}
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
const tag = process.env.RELEASE_TAG;
try {
const response = await github.rest.repos.createRelease({
draft: false,
generate_release_notes: true,
name: `Release ${tag}`,
owner: context.repo.owner,
prerelease: tag.includes("rc-") || tag.includes("preview") || tag.includes("beta") || tag.includes("alpha"),
repo: context.repo.repo,
tag_name: tag,
});
core.exportVariable('RELEASE_ID', response.data.id);
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url);
} catch (error) {
core.setFailed(error.message);
}

0 comments on commit caa6694

Please sign in to comment.