Skip to content

Commit 379f7a1

Browse files
committed
feat: add "pkg_rel" in release number
1 parent 871d5c7 commit 379f7a1

File tree

6 files changed

+56
-12
lines changed

6 files changed

+56
-12
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ jobs:
1818
runs-on: ubuntu-latest
1919
outputs:
2020
pkg_version: ${{ steps.var.outputs.pkg_version }}
21+
pkg_rel: ${{ steps.var.outputs.pkg_rel }}
2122
steps:
2223
- name: Checkout the repo
2324
uses: actions/checkout@v3
2425

25-
- name: Check last version
26-
run: bash ./scripts/check-last-version.bash
27-
2826
- name: Import environment variables
2927
shell: bash
3028
run: |
@@ -36,12 +34,16 @@ jobs:
3634
id: var
3735
run: . ./scripts/set-env-vars.bash
3836

37+
- name: Check last version
38+
run: bash ./scripts/check-last-version.bash
39+
3940
artifact:
4041
runs-on: ubuntu-latest
4142
needs: check
4243
container: mpsq/emacs-builder:latest
4344
env:
4445
PKG_VERSION: ${{ needs.check.outputs.pkg_version }}
46+
PKG_REL: ${{ needs.check.outputs.pkg_rel }}
4547
steps:
4648
- name: Checkout the repo
4749
uses: actions/checkout@v3
@@ -58,9 +60,9 @@ jobs:
5860

5961
- uses: ncipollo/release-action@v1
6062
with:
61-
tag: ${{ needs.check.outputs.pkg_version }}
63+
tag: ${{ needs.check.outputs.pkg_version }}-${{ needs.check.outputs.pkg_rel }}
6264
bodyFile: ${{ env.USR_HOME }}/body.md
63-
name: Release ${{ needs.check.outputs.pkg_version }}
65+
name: Release ${{ needs.check.outputs.pkg_version }}-${{ needs.check.outputs.pkg_rel }}
6466
artifactContentType: application/gzip
6567
artifacts: ${{ env.USR_HOME }}/${{ needs.check.outputs.pkg_version }}.tar.gz
6668
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/manual.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,29 @@ on:
88
old_commit_n:
99
description: "Commit # for upstream"
1010
required: true
11+
release:
12+
description: "Wether or not to create a new release"
13+
required: true
14+
type: boolean
15+
pkg_rel:
16+
description: "Package release #"
17+
required: true
1118

1219
env:
1320
OLD_COMMIT_N: ${{ github.event.inputs.old_commit_n }}
1421
NEW_COMMIT_N: ${{ github.event.inputs.new_commit_n }}
22+
I_PKG_REL: ${{ github.event.inputs.pkg_rel }}
1523

1624
jobs:
1725
check:
1826
runs-on: ubuntu-latest
1927
outputs:
2028
pkg_version: ${{ steps.var.outputs.pkg_version }}
29+
pkg_rel: ${{ steps.var.outputs.pkg_rel }}
2130
steps:
2231
- name: Checkout the repo
2332
uses: actions/checkout@v3
2433

25-
- name: Check last version
26-
run: bash ./scripts/check-last-version.bash
27-
2834
- name: Import environment variables
2935
shell: bash
3036
run: |
@@ -36,12 +42,17 @@ jobs:
3642
id: var
3743
run: . ./scripts/set-env-vars.bash
3844

45+
- name: Check last version
46+
if: ${{ inputs.release }}
47+
run: bash ./scripts/check-last-version.bash
48+
3949
artifact:
4050
runs-on: ubuntu-latest
4151
needs: check
4252
container: mpsq/emacs-builder:latest
4353
env:
4454
PKG_VERSION: ${{ needs.check.outputs.pkg_version }}
55+
PKG_REL: ${{ needs.check.outputs.pkg_rel }}
4556
steps:
4657
- name: Checkout the repo
4758
uses: actions/checkout@v3
@@ -65,3 +76,20 @@ jobs:
6576
name: emacs-manual-build
6677
path: ${{ env.USR_HOME }}/${{ needs.check.outputs.pkg_version }}.tar.gz
6778
retention-days: 5
79+
80+
- uses: ncipollo/release-action@v1
81+
if: ${{ inputs.release }}
82+
with:
83+
tag: ${{ needs.check.outputs.pkg_version }}-${{ needs.check.outputs.pkg_rel }}
84+
bodyFile: ${{ env.USR_HOME }}/body.md
85+
name: Release ${{ needs.check.outputs.pkg_version }}-${{ needs.check.outputs.pkg_rel }}
86+
artifactContentType: application/gzip
87+
artifacts: ${{ env.USR_HOME }}/${{ needs.check.outputs.pkg_version }}.tar.gz
88+
token: ${{ secrets.GITHUB_TOKEN }}
89+
90+
- name: Push to AUR
91+
if: ${{ inputs.release }}
92+
env:
93+
PRIV_KEY: ${{ secrets.PRIV_KEY }}
94+
PUB_KEY: ${{ secrets.PUB_KEY }}
95+
run: bash ./scripts/push-to-aur.bash

assets/variables

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ AUR_IP=95.216.144.15
33
AUR_PKG=emacs-gcc-wayland-devel-bin
44
USR=pcr
55
USR_HOME=/home/pcr
6-
PKG_REL=1
76
UPSTREAM_API=https://api.github.com/repos/flatwhatson/emacs
87
UPSTREAM_BRANCH=pgtk-nativecomp-dev
98
UPSTREAM_REPO=https://github.com/flatwhatson/emacs

scripts/build-artifacts.bash

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ rm emacs-1-1-x86_64.pkg.tar.zst
2727
rm out/.BUILDINFO out/.MTREE out/.PKGINFO
2828
tar czf "$PKG_VERSION".tar.gz -C out .
2929

30+
if [[ "$NEW_COMMIT_N" == "$OLD_COMMIT_N" ]]; then
31+
touch body.md
32+
exit 0
33+
fi
34+
3035
# Get release body
3136
delta=$(echo "$NEW_COMMIT_N - $OLD_COMMIT_N" | bc)
3237
echo -en "# Commits since last release\n\n" >body.md

scripts/check-last-version.bash

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

33
set -euxo pipefail
44

5-
# Check if a new release is needed
6-
if [ "$OLD_COMMIT_N" == "$NEW_COMMIT_N" ]; then exit 1; else exit 0; fi
5+
status_code=$(curl -s -o "/dev/null" -w "%{http_code}" "https://api.github.com/repos/mpsq/emacs-gcc-wayland-devel-builder/releases/tags/$NEW_COMMIT_N-$PKG_REL")
6+
7+
if [[ "$status_code" == "200" ]]; then
8+
exit 1
9+
fi

scripts/set-env-vars.bash

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,11 @@ PKG_VERSION+="$NEW_COMMIT_N"
1414

1515
# Export to env var + github action var
1616
export PKG_VERSION="${PKG_VERSION}"
17-
echo "pkg_version=$PKG_VERSION" >> $GITHUB_OUTPUT
17+
echo "pkg_version=$PKG_VERSION" >> $GITHUB_OUTPUT
18+
19+
pkgrel="1"
20+
if [[ -v I_PKG_REL ]]; then
21+
pkgrel="$I_PKG_REL"
22+
fi
23+
export PKG_REL="${pkgrel}"
24+
echo "pkg_rel=$pkgrel" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)