Skip to content

Commit c3dad27

Browse files
committed
refactor: streamline vars + remove dead code (fix #2)
1 parent ad3085c commit c3dad27

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ on:
1010
required: true
1111

1212
env:
13-
SELF_GH: https://api.github.com/repos/mpsq/emacs-gcc-wayland-devel-builder
14-
UPSTREAM_GH: https://api.github.com/repos/flatwhatson/emacs
13+
UPSTREAM_API: https://api.github.com/repos/flatwhatson/emacs
14+
UPSTREAM_BRANCH: pgtk-nativecomp
15+
UPSTREAM_REPO: https://github.com/flatwhatson/emacs
16+
UPSTREAM_SRC: https://raw.githubusercontent.com/flatwhatson/emacs/pgtk-nativecomp
1517

1618
jobs:
1719
check:
@@ -28,7 +30,7 @@ jobs:
2830
id: var
2931
run: . ./ci/set-env-vars.bash
3032
outputs:
31-
ver: ${{ steps.var.outputs.ver }}
33+
pkg_version: ${{ steps.var.outputs.pkg_version }}
3234

3335
artifact:
3436
runs-on: ubuntu-20.04
@@ -39,7 +41,7 @@ jobs:
3941
env:
4042
OLD_COMMIT_N: ${{ github.event.inputs.old_commit_n }}
4143
NEW_COMMIT_N: ${{ github.event.inputs.new_commit_n }}
42-
PKG_VERSION: ${{ needs.check.outputs.ver }}
44+
PKG_VERSION: ${{ needs.check.outputs.pkg_version }}
4345
steps:
4446
- name: Checkout the repo
4547
uses: actions/checkout@v2
@@ -53,8 +55,8 @@ jobs:
5355
env:
5456
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5557
with:
56-
tag_name: ${{ needs.check.outputs.ver }}
57-
release_name: Release ${{ needs.check.outputs.ver }}
58+
tag_name: ${{ needs.check.outputs.pkg_version }}
59+
release_name: Release ${{ needs.check.outputs.pkg_version }}
5860
body_path: /home/pcr/body.md
5961
draft: false
6062
prerelease: false
@@ -65,8 +67,8 @@ jobs:
6567
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6668
with:
6769
upload_url: ${{ steps.create_release.outputs.upload_url }}
68-
asset_path: /home/pcr/${{ needs.check.outputs.ver }}.tar.gz
69-
asset_name: ${{ needs.check.outputs.ver }}.tar.gz
70+
asset_path: /home/pcr/${{ needs.check.outputs.pkg_version }}.tar.gz
71+
asset_name: ${{ needs.check.outputs.pkg_version }}.tar.gz
7072
asset_content_type: application/gzip
7173
- name: Push to AUR
7274
env:

ci/build-artifacts.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ tar czf "$PKG_VERSION".tar.gz -C out .
2121
# Get release body
2222
delta=$(echo "$NEW_COMMIT_N - $OLD_COMMIT_N" | bc)
2323
echo -en "# Commits since last release\n\n" > body.md
24-
echo -en "Check [upstream](https://github.com/flatwhatson/emacs/commits) for the full history.\n\n" >> body.md
24+
echo -en "Check [upstream]("$UPSTREAM_REPO"/commits) for the full history.\n\n" >> body.md
2525

2626
# Get the list of commits since last release
27-
curl -s "$UPSTREAM_GH"/commits?per_page="$delta" | \
27+
curl -s "$UPSTREAM_API"/commits?per_page="$delta" | \
2828
# Parse and retain only the commit message + its url
2929
jq -r '.[] | (.commit.message | capture("(?<id>.+)\n").id) + " [commit](" + .html_url + ")"' | \
3030
# Remove "Merge" commits

ci/set-env-vars.bash

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
set -euxo pipefail
44

5-
VER=$(curl -s https://raw.githubusercontent.com/flatwhatson/emacs/pgtk-nativecomp/configure.ac | grep AC_INIT | sed -e 's/^.\+\ \([0-9]\+\.[0-9]\+\.[0-9]\+\?\).\+$/\1/')
6-
VER+="."
7-
VER+="$NEW_COMMIT_N"
5+
PKG_VERSION=$(
6+
curl -s "$UPSTREAM_SRC"/configure.ac | \
7+
grep AC_INIT | \
8+
sed -e 's/^.\+\ \([0-9]\+\.[0-9]\+\.[0-9]\+\?\).\+$/\1/'
9+
)
10+
PKG_VERSION+="."
11+
PKG_VERSION+="$NEW_COMMIT_N"
812

9-
export VER="${VER}"
13+
export PKG_VERSION="${PKG_VERSION}"
1014

11-
echo "::set-output name=ver::${VER}"
15+
echo "::set-output name=pkg_version::${PKG_VERSION}"

pull.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
if [[ -d "emacs" ]]; then
44
cd emacs
55
git checkout .
6-
git pull --rebase origin pgtk-nativecomp
6+
git pull --rebase origin "$UPSTREAM_BRANCH"
77
else
8-
git clone --depth=1 https://github.com/flatwhatson/emacs
8+
git clone --depth=1 "$UPSTREAM_REPO"
99
cd emacs
1010
fi

0 commit comments

Comments
 (0)