-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (91 loc) · 3.45 KB
/
release-bump.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Release - Bump Version
## Release automation for pact's published packages in brew
# Designed to run systems in kadena-io/homebrew-pact
# There is a
run-name: "Release homebrew pact ${{ inputs.release_sha }} from ${{ github.sha}}"
on:
workflow_dispatch:
inputs:
pact_intel:
description: "url of latest pact release package for intel"
type: string
required: false
pact_arm:
description: "url of latest pact release package for arm"
type: string
required: false
pact_head:
description: "url of latest pact-5 release package for arm"
type: string
required: false
workflow_call:
inputs:
pact_intel:
description: "url of latest pact release package for intel"
type: string
required: false
pact_arm:
description: "url of latest pact release package for arm"
type: string
required: false
pact_head:
description: "url of latest pact-5 release package for arm"
type: string
required: false
jobs:
Update-References:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
repository: kadena-io/homebrew-pact
ssh-key: ${{ secrets.GH_DEPLOYKEY_PACTBREW }}
- name: Update GHC version if needed
run: |
# we fire this function for every possible url so stop if no url was passed to script
# get release to calculate sha (and exit if the curl fails)
# escape the release URL / characters
# replace the release url and sha
# blank out variables to prevent conflicts
replace_in_rb() {
ON_TARGET=$1
RELEASE_URL=$2
HEAD_SEARCH=$3
if [[ -z "$RELEASE_URL" ]]; then
echo "$ON_TARGET is blank, not updating url"
return 0
else
echo "$ON_TARGET will be updated to $RELEASE_URL"
fi
curl -L "$RELEASE_URL" --output target.tar.gz || exit 1
RELEASE_SHA=`shasum -a 256 target.tar.gz | awk '{ print $1 }'`
RELEASE_URL=$(printf '%s\n' "$RELEASE_URL" | sed 's:[\\/&]:\\&:g; $!s/$/\\/')
sed -i --regexp-extended -z "s/($HEAD_SEARCH)($ON_TARGET do\n[ ]*)url \"([a-z0-9:\/\.\-]+)\"(\n[ ]*sha256 \")([0-9a-f]+)\"/\1\2url \"$RELEASE_URL\"\4$RELEASE_SHA\"/" pact.rb
ON_TARGET=""
RELEASE_URL=""
HEAD_SEARCH=""
}
replace_in_rb on_intel "${{ inputs.pact_intel }}"
replace_in_rb on_arm "${{ inputs.pact_arm }}"
replace_in_rb on_arm "${{ inputs.pact_head }}" '\<head do\>\n[ ]*'
- name: Validate pact arm nightly release
run: |
brew install --build-from-source pact.rb --head
pact -v
brew uninstall pact
- name: Validate pact arm release
run: |
brew install --build-from-source pact.rb --head
pact -v
brew uninstall pact
- name: Update master branch with new homebrew
run: |
git config --local user.name "Kadena DevOps"
git config --local user.email "devops@kadena.io"
git add pact.rb
git commit --allow-empty -m "pact package version update"
# allow empty in case this is a re-run
git status
git tag chainweb-${{ inputs.VERSION_NEW }}
git push
git push --force origin --tags