-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (48 loc) · 2 KB
/
update-binary.yml
File metadata and controls
59 lines (48 loc) · 2 KB
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
name: Update Binary
on:
workflow_dispatch:
schedule:
# Mon at 5am weekly
- cron: "00 5 * * 0"
jobs:
update-binary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Latest Release
working-directory: ./nowsecure/bin
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LATEST_VERSION=$(gh release --repo nowsecure/nowsecure-ci view --json tagName --jq '.tagName')
CURRENT_VERSION=$(cat version)
if [ "$LATEST_VERSION" = "$CURRENT_VERSION" ]; then
echo "Current version ($CURRENT_VERSION) is latest"
else
echo "$LATEST_VERSION" > version
find . -name 'ns_*' -delete
gh release --repo nowsecure/nowsecureci download --clobber \
--pattern 'ns_darwin-arm64*' \
--pattern 'ns_linux-amd64*' \
--pattern 'ns_windows-amd64*'
# Github release has tgz and zip files, each containing license and readme files
find . -name '*.tgz' -exec tar -xzf {} \;
find . -name '*.zip' -exec unzip {} \;
rm LICENSE README.md
echo "RELEASE_NOTES=$(gh release --repo nowsecure/nowsecure-ci view --json body --jq '.body')" >> "$GITHUB_ENV"
fi
echo "LATEST_VERSION=$LATEST_VERSION" >> "$GITHUB_ENV"
- name: Commit changes
working-directory: ./nowsecure/bin
run: |
PR_TITLE="chore(deps): update nowsecure-ci binary to ${{ env.LATEST_VERSION }}"
BRANCH_NAME="chore/ns-binary/${{ env.LATEST_VERSION }}"
git config --global user.email "devops@nowsecure.com"
git config --global user.name "Nora The Narwhal"
if [[ -n "$(git status --porcelain)" ]]; then
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "$PR_TITLE"
git push
gh pr create --title "$PR_TITLE" --body "# NowSecure CI Release Notes \n ${{ env.RELEASE_NOTES }}"
fi