Skip to content

Commit

Permalink
custom release action
Browse files Browse the repository at this point in the history
  • Loading branch information
karan-batavia committed Nov 6, 2024
1 parent 36025c2 commit 4775d50
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/draft_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Draft a new release

on:
push:
branches: ["main"]

jobs:
create_release:
env:
OWNER: "Privado-Inc"
BRANCH: "main"
REPO: "privado"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-22.04
steps:
- name: Create an incremental tag
id: generate-tag
run: |
latest_tag=$(gh api repos/$OWNER/$REPO/tags --jq '.[0].name')
new_tag=$(echo $latest_tag | awk -F. '{print $1"."$2"."$3+1}')
latest_commit_sha=$(gh api repos/$OWNER/$REPO/git/refs/heads/$BRANCH --jq '.object.sha')
gh api repos/$OWNER/$REPO/git/refs \
-f ref="refs/tags/$new_tag" \
-f sha=$latest_commit_sha
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
- name: Create a release
run: gh release create ${{ steps.generate-tag.outputs.new_tag }} --draft --generate-notes --target main --title "${{ steps.generate-tag.outputs.new_tag }} 🌈" --repo "${{ env.OWNER }}/${{ env.REPO }}"

0 comments on commit 4775d50

Please sign in to comment.