Skip to content

Commit

Permalink
Create release workflow (#192)
Browse files Browse the repository at this point in the history
* create release workflow

* fix lint errors

---------

Co-authored-by: Gulom Alimov <[email protected]>
  • Loading branch information
Googlom and Gulom Alimov authored Apr 24, 2024
1 parent ee7d736 commit 0515942
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release Piper Action

on:
workflow_dispatch: # trigger release manually
schedule:
- cron: '0 9 * * 1' # at 9 am every Monday

jobs:
check_if_should_run:
name: Check if should run
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4

# For scheduled runs check if there has been a commit in the last week
- id: should_run
if: ${{ github.event_name == 'schedule' }}
name: Check latest commits
run: |
if [[ -n $(git rev-list --after="7 days" ${{ github.sha }}) ]]
then
echo "should_run=true" >> "$GITHUB_OUTPUT"
else
echo "No commits for the past 7 days"
fi
# For manual release trigger
- if: ${{ github.event_name == 'workflow_dispatch' }}
run: echo "should_run=true" >> "$GITHUB_OUTPUT"

release:
name: Release
needs: check_if_should_run
if: ${{ needs.check_if_should_run.outputs.should_run == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Increment version
id: version
uses: reecetech/[email protected]
with:
scheme: semver
increment: minor

- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
generate_release_notes: true
make_latest: true

0 comments on commit 0515942

Please sign in to comment.