Skip to content

Commit

Permalink
Change branch naming
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelirh committed Jun 5, 2024
1 parent fa781b5 commit 50f3c5c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
53 changes: 31 additions & 22 deletions .github/workflows/release-repository.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ name: Release repository
on:
workflow_dispatch:
inputs:
source_branch:
description: Source branch for the release.
required: true
target_branch:
description: Target branch for the release.
required: true
required: false
default: ros2
version:
description: New version (used for tag).
required: true
date:
description: Date stamp of the image to be used in the compose files.
required: true
release_name:
description: Name of the release to be created. Version in the first place is recommended (e.g.
description:
Name of the release to be created. Version in the first place is recommended (e.g.
`2.0.0-alpha`).
required: true
automatic_mode:
Expand All @@ -34,12 +39,11 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCH: release-${{ github.event.inputs.version }}
DOCKER_IMAGE_TAG: humble-${{ github.event.inputs.version }}-${{ github.event.inputs.date }}-stable
MAIN_BRANCH: ros2
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.target_branch }}
ref: ${{ github.event.inputs.source_branch }}

- name: Update docker image version
uses: mikefarah/yq@v4.43.1
Expand All @@ -56,59 +60,64 @@ jobs:
author_email: action-bot@action-bot.com
new_branch: ${{ env.RELEASE_BRANCH }}

- name: Create pull request
- name: Create PR
run: |
gh pr create \
--base ${{ github.event.inputs.target_branch }} \
--base ${{ github.event.inputs.source_branch }} \
--head $RELEASE_BRANCH \
--title "Release ${{ github.event.inputs.version }}" \
--body "This PR incorporates tag(s) update in docker compose files."
- name: Merge pull request
- name: Merge PR
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true }}
run: |
gh pr merge $RELEASE_BRANCH \
--merge --delete-branch
- name: Checkout to main
if: ${{ github.event.inputs.target_branch != env.MAIN_BRANCH && fromJSON(github.event.inputs.automatic_mode)
- name: Checkout to target branch
if:
${{ github.event.inputs.source_branch != github.event.inputs.target_branch && fromJSON(github.event.inputs.automatic_mode)
== true }}
uses: actions/checkout@v4
with:
ref: ${{ env.MAIN_BRANCH }}
ref: ${{ github.event.inputs.target_branch }}

- name: Create pull request to main
if: ${{ github.event.inputs.target_branch != env.MAIN_BRANCH && fromJSON(github.event.inputs.automatic_mode)
- name: Create PR to target branch
if:
${{ github.event.inputs.source_branch != github.event.inputs.target_branch && fromJSON(github.event.inputs.automatic_mode)
== true }}
run: |
gh pr create \
--base ${{ env.MAIN_BRANCH }} \
--head ${{ github.event.inputs.target_branch }} \
--title "Release ${{ steps.create_release_candidate.outputs.version}} to ${{ env.MAIN_BRANCH }}" \
--base ${{ github.event.inputs.target_branch }} \
--head ${{ github.event.inputs.source_branch }} \
--title "Release ${{ steps.create_release_candidate.outputs.version}} to ${{ github.event.inputs.target_branch }}" \
--body "This PR incorporates tag(s) update in docker compose files."
- name: Merge pull request to main
if: ${{ github.event.inputs.target_branch != env.MAIN_BRANCH && fromJSON(github.event.inputs.automatic_mode)
- name: Merge PR to target branch
if:
${{ github.event.inputs.source_branch != github.event.inputs.target_branch && fromJSON(github.event.inputs.automatic_mode)
== true }}
run: |
gh pr merge ${{ github.event.inputs.target_branch }} \
gh pr merge ${{ github.event.inputs.source_branch }} \
--merge --delete-branch
- name: Create prerelease
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease)
if:
${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease)
== true}}
run: |
gh release create ${{ github.event.inputs.version }} \
--target ${{ env.MAIN_BRANCH }} \
--target ${{ github.event.inputs.target_branch }} \
--title ${{ github.event.inputs.release_name }} \
--generate-notes \
--prerelease
- name: Create release
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease)
if:
${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease)
== false}}
run: |
gh release create ${{ github.event.inputs.version }} \
--target ${{ env.MAIN_BRANCH }} \
--target ${{ github.event.inputs.target_branch }} \
--title ${{ github.event.inputs.release_name }} \
--generate-notes
4 changes: 2 additions & 2 deletions .github/workflows/update-tags-in-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Update tags in compose files
on:
workflow_dispatch:
inputs:
target_branch:
source_branch:
description: Target branch for the update.
required: true
image_tag:
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.target_branch }}
ref: ${{ github.event.inputs.source_branch }}

- name: Update docker image tag
uses: mikefarah/yq@v4.43.1
Expand Down

0 comments on commit 50f3c5c

Please sign in to comment.