From 223b28f123bbdc52b65ec1aa0ed77c7a636181ef Mon Sep 17 00:00:00 2001 From: Tarun Koyalwar Date: Thu, 17 Nov 2022 16:02:37 +0530 Subject: [PATCH] adds autorelease gh action (closes #99) --- .github/workflows/autorelease.yml | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/autorelease.yml diff --git a/.github/workflows/autorelease.yml b/.github/workflows/autorelease.yml new file mode 100644 index 0000000..07845c0 --- /dev/null +++ b/.github/workflows/autorelease.yml @@ -0,0 +1,36 @@ +name: 🔖 Auto release gh action + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * 0' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get Commit Count + id: get_commit + run: git rev-list `git rev-list --tags --no-walk --max-count=1`..HEAD --count | xargs -I {} echo COMMIT_COUNT={} >> $GITHUB_OUTPUT + + - name: Create release and tag + if: ${{ steps.get_commit.outputs.COMMIT_COUNT > 0 }} + id: tag_version + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Create a GitHub release + if: ${{ steps.get_commit.outputs.COMMIT_COUNT > 0 }} + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.tag_version.outputs.new_tag }} + release_name: Release ${{ steps.tag_version.outputs.new_tag }} + body: ${{ steps.tag_version.outputs.changelog }}