From 0515942fbb84e12e057890f1c16302a48c744f36 Mon Sep 17 00:00:00 2001 From: Googlom <36107508+Googlom@users.noreply.github.com> Date: Wed, 24 Apr 2024 12:51:26 +0500 Subject: [PATCH] Create release workflow (#192) * create release workflow * fix lint errors --------- Co-authored-by: Gulom Alimov --- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..99d734f0 --- /dev/null +++ b/.github/workflows/release.yml @@ -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/version-increment@2024.4.1 + 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