This repository has been archived by the owner on Jan 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
60 lines (54 loc) · 2.45 KB
/
receive-dispatch-update-snapshot-version.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: update Apiman snapshot version
on:
workflow_dispatch:
repository_dispatch:
types:
- apiman-snapshot-version
jobs:
build:
runs-on: ubuntu-latest
env:
snapshot-version: ${{ github.event.client_payload.snapshot-version }}
outputs:
snapshot-version-changed: ${{ steps.check-version-change.outputs.snapshot-version-changed }}
steps:
- name: Checkout Apiman Docker repo
uses: actions/checkout@v3
- name: Default setup items
run: bash .github/workflows/support/setup.sh
- name: Update snapshot version in docker-release flow if changed
id: check-version-change
run: |
SNAPSHOT_VERSION_FILE=$(cat .github/workflows/SNAPSHOT_VERSION)
if [[ "$SNAPSHOT_VERSION_FILE" != "${{ env.snapshot-version }}" ]]
then
echo "Old version: $SNAPSHOT_VERSION_FILE - New version: ${{ env.snapshot-version }}"
echo ${{ env.snapshot-version }} > .github/workflows/SNAPSHOT_VERSION
echo ::set-output name=snapshot-version-changed::true
else
echo "Snapshot version was not changed"
echo ::set-output name=snapshot-version-changed::false
fi
- name: Update Maven versions, including parent (if version changed)
if: needs.read-version.outputs.snapshot-version-changed == 'true'
run: |
mvnd -ntp -N versions:update-parent -DparentVersion="[${{ env.snapshot-version }}]" -DgenerateBackupPoms=false
mvnd -ntp versions:set -DnewVersion="${{ env.snapshot-version }}" -DgenerateBackupPoms=false -DprocessAllModules=true
- name: Commit release snapshot update to repository (if version changed)
uses: EndBug/add-and-commit@v7.2.1
if: needs.read-version.outputs.snapshot-version-changed == 'true'
with:
author_name: apiman-ci
default_author: user_info
message: "chore(ci): update SNAPSHOT_VERSION to ${{ env.snapshot-version }}"
add: .github/workflows --force
rebuild-same-version-snapshot:
name: Rebuild snapshot version when code has changed, but snapshot version *not* changed
needs: build
uses: apiman/apiman-docker/.github/workflows/docker-test-release.yml@master
if: ${{ needs.build.outputs.snapshot-version-changed == 'false' }}
secrets: inherit
with:
apiman-version: ${{ github.event.client_payload.snapshot-version }}
push-to-repos: true
snapshot: true