Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support release branches #48

Merged
merged 14 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/controller-release-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: |-
Controller - Managing Release Branches and Tags

Manages long-living release branches and their releases

### Usage

```yaml
name: release
on:
release:
types:
- published

permissions:
contents: write
id-token: write

jobs:
terraform-module:
uses: cloudposse/github-actions-workflows/.github/workflows/controller-release-branches.yml@main

```

on:
workflow_call:
inputs:
runs-on:
description: "Overrides job runs-on setting (json-encoded list)"
type: string
required: false
default: '["ubuntu-latest"]'

jobs:
major-release-tagger:
runs-on: ${{ fromJSON(inputs.runs-on) }}
steps:
- uses: cloudposse/github-action-major-release-tagger@v1

release-branch-manager:
runs-on: ${{ fromJSON(inputs.runs-on) }}
steps:
- uses: cloudposse/github-action-release-branch-manager@v1
40 changes: 32 additions & 8 deletions .github/workflows/controller-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ name: |-
### Usage

```yaml
name: Draft release
name: release-branch
on:
workflow_call:
push:
branches:
- main
- release/**

permissions:
contents: write
id-token: write

jobs:
release:
Expand All @@ -19,8 +26,13 @@ name: |-
on:
workflow_call:
inputs:
ref:
description: "The release target, i.e. branch or commit it should point to"
ref_name:
description: "The release target, i.e. branch to release from"
required: false
default: ${{ github.ref_name }}
type: string
sha:
description: "Pull request merge commit sha"
required: false
default: ${{ github.sha }}
type: string
Expand All @@ -29,6 +41,11 @@ on:
required: false
default: auto-release.yml
type: string
publish:
description: "Publish github release if true and no-release PR label is not set."
required: false
default: true
type: boolean
runs-on:
description: "Overrides job runs-on setting (json-encoded list)"
type: string
Expand All @@ -46,13 +63,20 @@ jobs:
id: get-pull-request
uses: 8BitJonny/gh-get-current-pr@2.2.0
with:
sha: ${{ inputs.ref }}
sha: ${{ inputs.sha }}

- name: Do release
id: release
uses: release-drafter/release-drafter@v5
with:
publish: ${{ !contains(steps.get-pull-request.outputs.pr_labels, 'no-release') }}
publish: ${{ inputs.publish && !contains(steps.get-pull-request.outputs.pr_labels, 'no-release') }}
config-name: ${{ inputs.config-name }}
commitish: ${{ inputs.ref }}
commitish: ${{ inputs.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Verify release # Workaround for https://github.com/release-drafter/release-drafter/issues/1313
shell: bash
run: |
echo 'Checking release id not empty: "${{ steps.release.outputs.id }}"'
! test -z "${{ steps.release.outputs.id }}"