aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.github/workflows/pr-gh-actions.yml107
-rw-r--r--.github/workflows/test.yml21
2 files changed, 119 insertions, 9 deletions
diff --git a/.github/workflows/pr-gh-actions.yml b/.github/workflows/pr-gh-actions.yml
new file mode 100644
index 00000000..fa0cd465
--- /dev/null
+++ b/.github/workflows/pr-gh-actions.yml
@@ -0,0 +1,107 @@
1name: PR on GH Actions
2
3on:
4 push:
5 tags:
6 - 'v*'
7 workflow_dispatch:
8
9jobs:
10
11 SanitizeVersion:
12 runs-on: ubuntu-latest
13
14 outputs:
15 version: ${{ steps.version.outputs.version }}
16
17 steps:
18 - name: Extract version from the tag and set it as output
19 id: version
20 run: |
21 if [ "${{ github.ref_type }}" = "tag" ];
22 then
23 version=$(echo "${{ github.ref_name }}" | sed -e "s/v//g" | grep -oP '^(\d+\.\d+\.\d+)$')
24
25 if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]];
26 then
27 echo "version=${version}" >> "$GITHUB_OUTPUT"
28 else
29 echo "version=none" >> "$GITHUB_OUTPUT"
30 fi
31 else
32 echo "version=none" >> "$GITHUB_OUTPUT"
33 fi
34
35 CreatePullRequest:
36 runs-on: ubuntu-latest
37 needs:
38 - SanitizeVersion
39 if: ${{ github.ref_type == 'tag' && needs.SanitizeVersion.outputs.version != 'none' }}
40
41 env:
42 TARGET_REPOSITORY: luarocks/gh-actions-luarocks
43 NEW_BRANCH: luarocks-${{ needs.SanitizeVersion.outputs.version }}
44 NEW_COMMIT_MSG: 'LuaRocks: update to ${{ needs.SanitizeVersion.outputs.version }}'
45 NEW_PR_TITLE: 'LuaRocks: update to ${{ needs.SanitizeVersion.outputs.version }}'
46
47 # comma (,) separated list
48 # of users to mention in the
49 # body of the Pull Request
50 USERS_TO_MENTION: hishamhm
51
52 steps:
53
54 - uses: actions/checkout@v4
55 with:
56 repository: ${{ env.TARGET_REPOSITORY }}
57 token: ${{ secrets.GH_ACTIONS_LUAROCKS_TOKEN }}
58 path: gh-actions-luarocks
59
60 - name: Create a new branch
61 working-directory: gh-actions-luarocks
62 run: git checkout -b ${{ env.NEW_BRANCH }}
63
64 - name: Set user name and email on commit
65 working-directory: gh-actions-luarocks
66 run: |
67 git config user.name "github-actions[bot]"
68 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
69
70 - name: Replace default version on action.yml
71 working-directory: gh-actions-luarocks
72 run: |
73 sed -e "s/default: \".*\"/default: \"${{ needs.SanitizeVersion.outputs.version }}\"/g" -i action.yml
74
75 - name: Stage changes
76 working-directory: gh-actions-luarocks
77 run: git add action.yml
78
79 - name: Commit changes
80 working-directory: gh-actions-luarocks
81 run: git commit "--message=${{ env.NEW_COMMIT_MSG }}"
82
83 - name: Print diff
84 working-directory: gh-actions-luarocks
85 run: git show
86
87 - name: Push changes
88 working-directory: gh-actions-luarocks
89 run: git push --set-upstream origin ${{ env.NEW_BRANCH }}
90
91 - name: Submit Pull Request
92 working-directory: gh-actions-luarocks
93 env:
94 GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_LUAROCKS_TOKEN }}
95 run: |
96 PR_BODY=""
97
98 IFS=',' read -ra reviewers <<< "${{ env.USERS_TO_MENTION }}"
99 for i in "${reviewers[@]}"; do
100 PR_BODY+="CC @${i} "
101 done
102
103 gh pr create \
104 --repo "${{ env.TARGET_REPOSITORY }}" \
105 --head ${{ env.NEW_BRANCH }} \
106 --title "${{ env.NEW_PR_TITLE }}" \
107 --body "${PR_BODY}" \ No newline at end of file
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 0ecc63a5..5acc786a 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -2,17 +2,18 @@ name: test
2 2
3on: 3on:
4 push: 4 push:
5 branches: main 5 branches:
6 - main
6 paths-ignore: 7 paths-ignore:
7 - "docs" 8 - "docs"
8 - "**/*.md" 9 - "**/*.md"
9 pull_request: 10 pull_request:
10 branches: '*' 11 branches:
12 - '*'
11 paths-ignore: 13 paths-ignore:
12 - "docs" 14 - "docs"
13 - "**/*.md" 15 - "**/*.md"
14 workflow_dispatch: 16 workflow_dispatch:
15 branches: '*'
16 17
17jobs: 18jobs:
18 ############################################################################## 19 ##############################################################################
@@ -45,7 +46,9 @@ jobs:
45 with: 46 with:
46 luaVersion: ${{ matrix.lua-version }} 47 luaVersion: ${{ matrix.lua-version }}
47 48
48 - uses: leafo/gh-actions-luarocks@v5 49 - uses: luarocks/gh-actions-luarocks@master
50 with:
51 luaRocksVersion: "3.12.2"
49 52
50 - name: 'Setup macOS deps' 53 - name: 'Setup macOS deps'
51 if: ${{ contains(matrix.os, 'macos') }} 54 if: ${{ contains(matrix.os, 'macos') }}
@@ -301,7 +304,7 @@ jobs:
301 # The following env variables 304 # The following env variables
302 # only applies to Visual Studio 305 # only applies to Visual Studio
303 LUAROCKS_DEPS_DIR: c:\external 306 LUAROCKS_DEPS_DIR: c:\external
304 LUAROCKS_DEPS_OPENSSL_VER: "3.4.1" 307 LUAROCKS_DEPS_OPENSSL_VER: "3.5.1"
305 LUAROCKS_DEPS_ZLIB_VER: "1.3.1" 308 LUAROCKS_DEPS_ZLIB_VER: "1.3.1"
306 # The following env variable 309 # The following env variable
307 # applies to both Visual Studio and MinGW-w64 310 # applies to both Visual Studio and MinGW-w64
@@ -332,7 +335,7 @@ jobs:
332 if: ${{ matrix.COMPILER == 'vs' && steps.restore-zlib-tarball.outputs.cache-hit != 'true' }} 335 if: ${{ matrix.COMPILER == 'vs' && steps.restore-zlib-tarball.outputs.cache-hit != 'true' }}
333 run: | 336 run: |
334 curl -o "${{ github.workspace }}\zlib-${{ env.LUAROCKS_DEPS_ZLIB_VER }}.tar.gz" ^ 337 curl -o "${{ github.workspace }}\zlib-${{ env.LUAROCKS_DEPS_ZLIB_VER }}.tar.gz" ^
335 "https://zlib.net/zlib-${{ env.LUAROCKS_DEPS_ZLIB_VER }}.tar.gz" 338 "https://zlib.net/fossils/zlib-${{ env.LUAROCKS_DEPS_ZLIB_VER }}.tar.gz"
336 339
337 - name: Save zlib tarball 340 - name: Save zlib tarball
338 if: ${{ matrix.COMPILER == 'vs' && steps.restore-zlib-tarball.outputs.cache-hit != 'true' }} 341 if: ${{ matrix.COMPILER == 'vs' && steps.restore-zlib-tarball.outputs.cache-hit != 'true' }}
@@ -484,7 +487,7 @@ jobs:
484 } 487 }
485 488
486 if ($installerUrl -eq $null) { 489 if ($installerUrl -eq $null) {
487 throw "Installer not found for version $version"; 490 throw "Installer not found for version ${version}. Please, update OpenSSL to the latest version found at ${jsonUrl}";
488 } 491 }
489 492
490 # Download the installer 493 # Download the installer
@@ -594,11 +597,11 @@ jobs:
594 SET "CURRENT_LUA_BIN=%CURRENT_LUA_DIR%\bin" 597 SET "CURRENT_LUA_BIN=%CURRENT_LUA_DIR%\bin"
595 SET "CURRENT_LUA_INTERPRETER=%CURRENT_LUA_BIN%\lua.exe" 598 SET "CURRENT_LUA_INTERPRETER=%CURRENT_LUA_BIN%\lua.exe"
596 599
597 pip install hererocks && ^ 600 pip install git+https://github.com/luarocks/hererocks && ^
598 hererocks ^ 601 hererocks ^
599 "%CURRENT_LUA_DIRNAME%" ^ 602 "%CURRENT_LUA_DIRNAME%" ^
600 "--${{ matrix.LUAT }}" "${{ matrix.LUAV }}" ^ 603 "--${{ matrix.LUAT }}" "${{ matrix.LUAV }}" ^
601 --luarocks latest ^ 604 --luarocks "3.12.2" ^
602 "--target=${{ matrix.COMPILER }}" 605 "--target=${{ matrix.COMPILER }}"
603 606
604 IF %ERRORLEVEL% NEQ 0 ( 607 IF %ERRORLEVEL% NEQ 0 (