-
Notifications
You must be signed in to change notification settings - Fork 50
49 lines (41 loc) · 1.51 KB
/
build-artifacts.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
name: Build Artifacts
on:
push:
branches:
- "main"
pull_request:
jobs:
build-artifacts:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.sha }}
fetch-depth: 0
- name: Grab version in `package.json` in main
run: echo "version=$(cat package.json | jq -r .version)" >> $GITHUB_OUTPUT
id: base-version
- name: Checkout develop branch
uses: actions/checkout@v3
- name: Grab version in `package.json` in develop
run: echo "version=$(cat package.json | jq -r .version)" >> $GITHUB_OUTPUT
id: new-version
- name: Compare versions
uses: madhead/semver-utils@latest
id: comparison
with:
version: ${{ steps.new-version.outputs.version }}
compare-to: ${{ steps.base-version.outputs.version }}
- name: Check if version increased
id: check
run: |
[[ ">" == "${{ steps.comparison.outputs.comparison-result }}" ]] && echo "changed=true" || echo "changed=false" >> "$GITHUB_OUTPUT"
# Trigger Release
- name: Repository Dispatch
if: github.event_name == 'push' && steps.check.outputs.changed == 'true'
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
event-type: trigger-release
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'