Skip to content

Commit

Permalink
Update github action
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotochleb committed Mar 22, 2023
1 parent edc9ca5 commit 2d0759c
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO: specify bump command and remove this description

Bump version workflow is triggered when PR is closed, it bumps version and triggers docker build that will be tagged with version number. To use it you have to specify bump type, available commands: `bump::patch`, `bump::minor` and `bump::major` (simply leave one of them in PR description and remove this description).
60 changes: 60 additions & 0 deletions .github/workflows/bump_version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Bump version
on:
workflow_dispatch:
inputs:
name:
description: "Version to bump (major, minor, patch)"
default: "patch"
required: true
pull_request:
branches: ros1
types: [closed]

jobs:
get-bump:
name: Get version bump
runs-on: ubuntu-latest
outputs:
bump: ${{ env.BUMP }}
steps:
- if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
name: Get version bump
id: get-version-bump
uses: husarion-ci/[email protected]
- if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
run: echo "BUMP=${{ steps.get-version-bump.outputs.bump }}" >> $GITHUB_ENV
- if: github.event_name == 'workflow_dispatch'
run: echo "BUMP=${{ github.event.inputs.name }}" >> $GITHUB_ENV

catkin-release:
name: Bump version
runs-on: ubuntu-latest
needs: get-bump
outputs:
new_version: ${{ steps.catkin-release.outputs.new_version }}
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Catkin release
id: catkin-release
uses: husarion-ci/[email protected]
with:
bump: ${{ needs.get-bump.outputs.bump }}
github_token: ${{ secrets.GITHUB_TOKEN }}
git_user: action-bot
git_email: [email protected]

build-and-push-docker-image:
name: Create new docker image
runs-on: ubuntu-latest
needs: catkin-release
steps:
- name: trigger the endpoint
run: >
curl -X POST
-H "Accept: application/vnd.github+json"
-H "Authorization: Bearer ${{ secrets.GH_PAT }}"
https://api.github.com/repos/husarion/panther-docker/dispatches
-d '{"event_type":"ros-package-update","client_payload":{"image_version":"${{ needs.catkin-release.outputs.new_version }}"}}'

0 comments on commit 2d0759c

Please sign in to comment.