Skip to content

Commit

Permalink
let's try to have different actions for open pull_request and merge p…
Browse files Browse the repository at this point in the history
…ull_request
  • Loading branch information
JaSei committed Oct 27, 2023
1 parent 515baef commit f8c5c38
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/a.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,32 @@ name: Service A

on:
push:
branch:
- master
- main
paths:
- .github/workflows/a.yaml
- .github/workflows/service.yaml
- services/a
pull_request:
branch:
- master
- main
paths:
- .github/workflows/a.yaml
- .github/workflows/service.yaml
- services/a

push-job:
if: github.event.action == 'merged'
call-service-worflow:
uses: ./.github/workflows/_service_release.yaml
with:
service_name: a

jobs:
pull-request-job:
if: github.event.action == 'opened'
call-service-worflow:
uses: ./.github/workflows/service.yaml
uses: ./.github/workflows/_service_test.yaml
with:
service_name: a
21 changes: 16 additions & 5 deletions .github/workflows/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,27 @@ jobs:
- name: Run service ${{ inputs.service_name }} test script
run: ./test.sh

- name: Get next version
uses: reecetech/[email protected]
id: version
- name: Generate release tag
id: generate_release_tag
uses: amitsingh-007/[email protected]
with:
scheme: calver
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: '${{ inputs.service_name }}/'
tag_template: 'yyyy.mm.i'


- name: Build docker image
run: make build

- name: Release docker image
env:
VERSION: ${{ steps.version.outputs.version }}
VERSION: ${{ steps.generate_release_tag.outputs.next_release_tag }}
run: make release

- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.generate_release_tag.outputs.next_release_tag }}
release_name: Release ${{ steps.generate_release_tag.outputs.next_release_tag }}

0 comments on commit f8c5c38

Please sign in to comment.