Skip to content

Commit

Permalink
Change: Use a single workflow file for releases
Browse files Browse the repository at this point in the history
Merge manual and automatic releases (via PR label) into a single
CI workflow.
  • Loading branch information
bjoernricks committed Feb 10, 2023
1 parent 6528f7a commit 145db65
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 44 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/release-pontos-manually.yml

This file was deleted.

40 changes: 24 additions & 16 deletions .github/workflows/release-pontos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,31 @@ name: Release Python package with pontos
on:
pull_request:
types: [closed]
workflow_dispatch:

jobs:
build-and-release:
name: Build and release with pontos
# If the label 'make release' is set. If PR is closed because of an merge
if: contains( github.event.pull_request.labels.*.name, 'make release') && github.event.pull_request.merged == true
runs-on: 'ubuntu-latest'
name: Create a new release with pontos
# If the event is a workflow_dispatch or the label 'make release' is set and PR is closed because of a merge
if: (github.event_name == 'workflow_dispatch') || (contains( github.event.pull_request.labels.*.name, 'make release') && github.event.pull_request.merged == true)
runs-on: "ubuntu-latest"
steps:
- name: Release with release action
uses: greenbone/actions/release-python@v2
with:
version: 3.8
conventional-commits: true
github-user: ${{ secrets.GREENBONE_BOT }}
github-user-mail: ${{ secrets.GREENBONE_BOT_MAIL }}
github-user-token: ${{ secrets.GREENBONE_BOT_TOKEN }}
gpg-key: ${{ secrets.GPG_KEY }}
gpg-fingerprint: ${{ secrets.GPG_FINGERPRINT }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
strategy: calendar
- name: Setting the Reference
run: |
if [[ "${{ github.event_name }}" = "workflow_dispatch" ]]; then
echo "RELEASE_REF=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "RELEASE_REF=${{ github.base_ref }}" >> $GITHUB_ENV
fi
- name: Release with release action
uses: greenbone/actions/release@v2
with:
conventional-commits: true
github-user: ${{ secrets.GREENBONE_BOT }}
github-user-mail: ${{ secrets.GREENBONE_BOT_MAIL }}
github-user-token: ${{ secrets.GREENBONE_BOT_TOKEN }}
gpg-key: ${{ secrets.GPG_KEY }}
gpg-fingerprint: ${{ secrets.GPG_FINGERPRINT }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
strategy: calendar
ref: ${{ env.RELEASE_REF }}

0 comments on commit 145db65

Please sign in to comment.