forked from Chia-Network/cadt
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (69 loc) · 2.74 KB
/
auto-release.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
# Compares the version in package.json to tags on the repo. If the tag doesn't exist, a new tag is created, which
# then triggers the normal "on tag" release automation in the build job
name: Auto Tag
on:
push:
branches:
- main
concurrency:
group: main-release-check
jobs:
check-version:
name: Tag and Release
runs-on: ubuntu-latest
steps:
- name: Clean workspace
uses: Chia-Network/actions/clean-workspace@main
- name: Checkout current branch
uses: actions/checkout@v3
with:
# Need PACKAGE_ADMIN_PAT token so when the tag is created, the tag automation runs
token: ${{ secrets.PACKAGE_ADMIN_PAT }}
fetch-depth: 0
- name: Configure commit signing for ChiaAutomation
uses: Chia-Network/actions/commit-sign/gpg@main
with:
gpg_private_key: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_KEY }}
passphrase: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_PASSPHRASE }}
- name: Check for current version tag. Create if it doesn't exist
run: |
version=$(cat $GITHUB_WORKSPACE/package.json | jq -r '.version')
echo "Version is: $version"
if [ $(git tag -l "$version") ]; then
echo "Tag exists, nothing to do"
else
echo "Tag does not exist. Creating and pushing tag"
rm -f CHANGELOG.md
npx conventional-changelog-cli -p angular -i CHANGELOG.md -s -r 0
changes=$(npx conventional-changelog-cli -r 1 | tail -n +2)
git add CHANGELOG.md
git commit -m "chore: Updating changelog for $version"
git tag $version -m "Release $version \n$changes"
git push origin $version
git push origin main
fi
- name: Checkout develop branch
uses: actions/checkout@v3
with:
# Need PACKAGE_ADMIN_PAT token so when the tag is created, the tag automation runs
token: ${{ secrets.PACKAGE_ADMIN_PAT }}
fetch-depth: 0
ref: 'develop'
- name: Auto-update dev dependencies
run: |
echo "Checking if dev dependencies need updating..."
if $(npx --yes npm-check-updates --dep dev --silent --errorLevel 2)
then
echo "No updates found - exiting"
exit 0
else
echo "Applying updates to package.json..."
npx --yes npm-check-updates --dep dev -u
echo "Applying updates to the lock file..."
npm update -D
echo "Committing updates to the develop branch"
git add package-lock.json
git add package.json
git commit -m "chore: Updating npm dev dependencies"
git push origin develop
fi