-
Notifications
You must be signed in to change notification settings - Fork 6
46 lines (40 loc) · 1.46 KB
/
on-version-changed.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: On changes to composer.json, create a release if version changed
on:
# Trigger manually from https://github.com/Automattic/wp-openid-connect-server/actions/workflows/on-version-changed.yml
workflow_dispatch:
push:
branches:
- main
paths:
- 'composer.json'
jobs:
on-version-changed:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.output.outputs.changed }}
version: ${{ steps.output.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: salsify/action-detect-and-tag-new-version@v2
id: check-version
with:
version-command: jq '.version' composer.json
create-tag: false
- name: Set output
if: steps.check-version.outputs.current-version != steps.check-version.outputs.previous-version
id: output
run: |
echo "Detected version change from ${{ steps.check-version.outputs.previous-version }} to ${{ steps.check-version.outputs.current-version }}"
echo ::set-output name=changed::true
echo ::set-output name=version::${{ steps.check-version.outputs.current-version }}
call-create-release:
needs: on-version-changed
if: needs.on-version-changed.outputs.changed == 'true'
uses: ./.github/workflows/create-release.yml
permissions:
contents: write
with:
version: ${{ needs.on-version-changed.outputs.version }}