-
Notifications
You must be signed in to change notification settings - Fork 8
121 lines (101 loc) · 3.38 KB
/
cron-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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: 'cron-release'
on:
# FIXME: manual run
workflow_dispatch:
# run daily, 3:00 UTC
schedule:
- cron: '56 2 * * *'
jobs:
pr-checks:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 'Checkout pulp-ui (main)'
uses: actions/checkout@v4
with:
ref: 'main'
fetch-depth: 128
- name: 'Skip if no real changes since last npm version update'
run: |
LAST=`git blame package.json | grep '"version":' | awk '{ print $1 }'`
if git diff --exit-code "$LAST" -- src/ package.json; then
false
else
true
fi
- name: 'Install node 20'
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: 'Install python 3.13'
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: 'Install moreutils'
run: |
sudo apt-get -y install moreutils
# FIXME: reuse pr-checks.yml?
- name: 'Checks'
run: |
# fail if npm install had to change package-lock.json
npm install
git diff --exit-code package-lock.json
# dependencies
npm run lint-setup
# run linters
npm run lint
# run test
npm run test
- name: 'Set PULP_UI_VERSION'
run: |
# used in npm run build
echo "PULP_UI_VERSION=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: 'git config'
run: |
git config --local user.name "cron-release workflow"
git config --local user.email "[email protected]"
- name: 'Update gettext'
run: |
npm run gettext:extract
npm run gettext:compile
git add locale/
git commit -m "locale update on $(date --iso=d)" || true
- name: 'Increment npm version, version tag'
run: 'npm version patch'
- name: 'Set NPM_VERSION, TARBALL'
run: |
echo "NPM_VERSION=$(jq -r .version < package.json)" >> $GITHUB_ENV
echo "TARBALL=pulp-ui-$(date --iso=d).tar.gz" >> $GITHUB_ENV
- name: 'Build UI dist/'
run: 'npm run build'
- name: 'Build a tarball'
run: |
tar -C dist/ -czvf "$TARBALL" .
- name: 'Push, push tags'
run: |
git push
git push -f --tags
- name: 'Release'
run: |
gh release create v"$NPM_VERSION" --title "pulp-ui $NPM_VERSION $(date --iso=d)" --generate-notes
gh release upload v"$NPM_VERSION" "$TARBALL" --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Update CHANGES.md'
run: |
(
curl -s https://api.github.com/repos/pulp/pulp-ui/releases/latest | \
jq -r '.name,"",.body' | \
sed -e 's/^## /### /' -e 's/^pulp-ui \(.*\) \(.*\)/## \1 (\2) {: #\1 }/' | \
grep -v '^\* Bump .* by @dependabot in ' | \
sed -e 's/^\(\* .*\) by @[a-zA-Z][-a-zA-Z0-9_]\+ in https:\/\/github.com\/pulp\/pulp-ui\/pull\/\([0-9]\+\)$/\1 [#\2](https:\/\/github.com\/pulp\/pulp-ui\/pull\/\2)/'
echo
echo '---'
echo
cat CHANGES.md
) | sponge CHANGES.md
git add CHANGES.md
git commit -m "changelog update for $NPM_VERSION"
git push