Skip to content

Commit

Permalink
Support release branches (#83)
Browse files Browse the repository at this point in the history
* Support release branches

* rm comment

* fix runs-on

* fix comment

* fix outputs

* get tag name

* fix latest

* fix triggers

* fix release triggers

* filter commitish

* add shell

* debug

* debug

* debg

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* debug
  • Loading branch information
max-lobur committed Apr 27, 2023
1 parent 32e2abc commit 18eaf22
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ version-resolver:
- 'bug'
- 'hotfix'
default: 'minor'
filter-by-commitish: true

categories:
- title: '🚀 Enhancements'
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/feature-branch.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: feature-branch
on:
pull_request:
branches: [ main ]
types: [ opened, synchronize, reopened ]
branches:
- main
- release/**
types: [opened, synchronize, reopened, labeled, unlabeled]

permissions:
pull-requests: write
Expand All @@ -23,6 +25,11 @@ jobs:
secrets:
github_access_token: ${{ secrets.REPO_ACCESS_TOKEN }}

ci-labels:
runs-on: ubuntu-latest
steps:
- uses: cloudposse/github-action-release-label-validator@v1

ci-build-test:
runs-on: ubuntu-latest
steps:
Expand All @@ -49,4 +56,4 @@ jobs:
- run: |
echo '${{ toJSON(needs) }}' # easier debug
! ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}
needs: [ ci-readme, ci-codeowners, ci-build-test ]
needs: [ ci-readme, ci-codeowners, ci-labels, ci-build-test ]
9 changes: 8 additions & 1 deletion .github/workflows/release-branch.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
name: release-branch
on:
push:
branches: [ main ]
branches:
- main
- release/**
paths-ignore:
- '.github/**'
- 'docs/**'
- 'examples/**'
- 'test/**'

permissions:
contents: write
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/release-published.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: release-published
on:
release:
types:
- published

permissions:
contents: write
id-token: write

jobs:
controller-release-branches:
uses: cloudposse/github-actions-workflows/.github/workflows/controller-release-branches.yml@main
25 changes: 24 additions & 1 deletion .github/workflows/tag-pushed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,38 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check if tag belongs to the latest major release or is higher
id: check_tag
run: |
highest_tag=$(git tag -l | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$" | sort -rV | head -n1)
highest_major=$(echo $highest_tag | cut -d '.' -f 1)
test -n "$highest_major"
current_tag=${{ github.ref_name }}
current_major=$(echo $current_tag | cut -d '.' -f 1)
test -n "$current_major"
if [ $current_major -ge $highest_major ]; then
echo "is_latest_major=true" >> $GITHUB_OUTPUT
else
echo "is_latest_major=false" >> $GITHUB_OUTPUT
fi
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ github.repository }}
flavor: |
latest=false
tags: |
type=semver,pattern={{version}}
type=raw,value=latest,enable=${{ steps.check_tag.outputs.is_latest_major }}
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
- name: Login to DockerHub
uses: docker/login-action@v2
Expand Down

0 comments on commit 18eaf22

Please sign in to comment.