@@ -56,31 +56,34 @@ jobs:
5656 run : |
5757 pacman --noconfirm -S jq openssh bc
5858 cd /home/pcr
59- # Get version number
59+
60+ # Get/set version number
6061 version=$(ls emacs* | sed -r 's/.*([0-9]{2}\.[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{6}).*/\1/gi')
6162 echo "pkg_version=$version" >> $GITHUB_ENV
62- # Clean artifact
63+
64+ # Unpack artifacts
6365 mkdir pkg
6466 tar xf "$(ls emacs*)" -C pkg
6567 rm pkg/.BUILDINFO pkg/.MTREE pkg/.PKGINFO
6668 tar czf "$version".tar.gz -C pkg .
6769 sum=$(sha512sum "$version".tar.gz | sed -r 's/(.*)\s\s.*/\1/')
6870 echo "pkg_sum=$sum" >> $GITHUB_ENV
71+
6972 # Get release body
7073 delta=$(echo "$NEW_COMMIT_N - $OLD_COMMIT_N" | bc)
7174 echo -en "# Commits since last release\n\n" > body.md
7275 echo -en "Check [upstream](https://github.com//flatwhatson/emacs/commits) for the full history.\n\n" >> body.md
73- # Next command:
74- # 1. We get the list of commits since last release
75- # 2. We use jq to parse and retain only the commit message + its url
76- # 3. First sed to remove "Merge" commits
77- # 4. Second sed to remove any special char at the beginning of the message
78- # 5. Third sed to prepend the message with "- "
79- curl -s "$UPSTREAM_GH"/commits?per_page="$delta" |
80- jq -r '.[].commit | (.message | capture("(?<id>.+)\n").id) + " [commit](" + .html_url + ")"' |
81- sed '/^Merge/,+1 d ' |
82- sed 's/^[^[:alnum:]]*//' |
83- sed -r 's/(.*)/- \1/' >> body.md
76+
77+ # Get the list of commits since last release
78+ curl -s "$UPSTREAM_GH"/commits?per_page="$delta" | \
79+ # Parse and retain only the commit message + its url
80+ jq -r '.[].commit | (.message | capture("(?<id>.+)\n").id) + " [commit](" + .html_url + ")"' | \
81+ # Remove "Merge" commits
82+ sed '/^Merge/,+1 d' | \
83+ # Remove any special char at the beginning of the message
84+ sed 's/^[^[:alnum:]]*// ' | \
85+ # Prepend "- " to the message
86+ sed -r 's/(.*)/- \1/' >> body.md
8487 - name : Create Release
8588 id : create_release
8689 uses : actions/create-release@v1
@@ -111,27 +114,31 @@ jobs:
111114 run : |
112115 cd /root
113116 mkdir .ssh
117+
114118 # Setup SSH
115119 echo "$PUB_KEY" | tr -d '\r' > .ssh/id_aur.pub
116120 echo "$PRIV_KEY" | base64 --decode > .ssh/id_aur
117121 chmod 600 .ssh/id_aur
118122 echo -en 'Host aur.archlinux.org\n IdentityFile /root/.ssh/id_aur\n User aur\n' > .ssh/config
119123 ssh-keyscan aur.archlinux.org > .ssh/known_hosts
120124 ssh-keyscan 95.216.144.15 >> .ssh/known_hosts
125+
121126 # Setup git
122127 cd /home/pcr
123128 git config --global user.name "Méril Pilon"
124129 git config --global user.email "me@mpsq.org"
125130 git clone ssh://aur.archlinux.org/emacs-gcc-wayland-devel-bin.git
126131 chown -R pcr:pcr emacs-gcc-wayland-devel-bin
127132 cd emacs-gcc-wayland-devel-bin
128- # Amend PKG
133+
134+ # Amend package, set pkgver, sha512 sum and pkgrel + fix permissions
129135 sed -i -r -e 's~pkgver=.*~pkgver='$PKG_VERSION'~' PKGBUILD
130136 sed -i -r -e 's~sha512sums=.*~sha512sums=\("'"$PKG_SUM"'"\)~' PKGBUILD
131137 sed -i -r -e 's/pkgrel=.*/pkgrel=1/' PKGBUILD
132138 chown pcr:pcr PKGBUILD
133139 rm .SRCINFO
134140 su pcr -c "makepkg --printsrcinfo > .SRCINFO"
141+
135142 # Push changes
136143 git add .SRCINFO PKGBUILD
137144 git commit -m "Bump to $PKG_VERSION"
0 commit comments