-
Notifications
You must be signed in to change notification settings - Fork 0
feat: release v0.1.0 #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9813fee
feat: release v0.1.0
jarvis9443 df2d55d
ci: validate luarocks package
jarvis9443 485ba65
chore: address luarocks review feedback
jarvis9443 93f9953
chore: harden release parsing
jarvis9443 7b8dd8b
chore: tighten release workflow
jarvis9443 abafe91
ci: select packaged rockspec dynamically
jarvis9443 b1b7adb
chore: refine release workflow
jarvis9443 135af3a
test: cover native loader failures
jarvis9443 ca74811
chore: address package review feedback
jarvis9443 6cf1991
ci: pin luajit package validation runtime
jarvis9443 fbab3ad
ci: use lua command for package smoke
jarvis9443 ffc82a2
chore: harden release package selection
jarvis9443 703dc35
Address LuaRocks review comments
jarvis9443 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - "main" | ||
| paths: | ||
| - "rockspec/**" | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release | ||
|
jarvis9443 marked this conversation as resolved.
|
||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
jarvis9443 marked this conversation as resolved.
|
||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Install Lua | ||
| uses: leafo/gh-actions-lua@v10 | ||
| with: | ||
| luaVersion: "5.1.5" | ||
|
|
||
| - name: Install LuaRocks | ||
| uses: leafo/gh-actions-luarocks@v4 | ||
| with: | ||
| luarocksVersion: "3.11.1" | ||
|
|
||
| - name: Install upload dependency | ||
| run: luarocks install dkjson | ||
|
|
||
| - name: Extract release name | ||
| id: release_env | ||
| shell: bash | ||
| env: | ||
| HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | ||
| run: | | ||
| title="${HEAD_COMMIT_MESSAGE%%$'\n'*}" | ||
| re="^feat: release v?([0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?)$" | ||
| if [[ $title =~ $re ]]; then | ||
|
jarvis9443 marked this conversation as resolved.
|
||
| v=v${BASH_REMATCH[1]} | ||
| echo "version=${v}" >> $GITHUB_OUTPUT | ||
| echo "version_without_v=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT | ||
|
jarvis9443 marked this conversation as resolved.
|
||
| if [[ ${BASH_REMATCH[1]} == *-* ]]; then | ||
| echo "is_prerelease=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "is_prerelease=false" >> $GITHUB_OUTPUT | ||
| fi | ||
| else | ||
| echo "commit format is not correct (expected: feat: release vX.Y.Z[-prerelease])" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Verify rockspec exists | ||
| id: verify_rockspec | ||
|
jarvis9443 marked this conversation as resolved.
|
||
| shell: bash | ||
| env: | ||
| VERSION_WITHOUT_V: ${{ steps.release_env.outputs.version_without_v }} | ||
| run: | | ||
| rockspec_file="$(python3 - <<'PY' | ||
| import os | ||
| import re | ||
| from pathlib import Path | ||
|
|
||
| version = os.environ["VERSION_WITHOUT_V"] | ||
| pattern = re.compile(r"^lua-qjson-" + re.escape(version) + r"-(\d+)\.rockspec$") | ||
| matches = [] | ||
| for path in Path("rockspec").glob("lua-qjson-" + version + "-*.rockspec"): | ||
| match = pattern.match(path.name) | ||
| if match: | ||
| matches.append((int(match.group(1)), str(path))) | ||
| if not matches: | ||
| raise SystemExit("rockspec file not found for version " + version) | ||
| print(max(matches)[1]) | ||
| PY | ||
| )" | ||
| echo "rockspec_file=${rockspec_file}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Validate LuaRocks token | ||
| shell: bash | ||
| env: | ||
| LUAROCKS_TOKEN: ${{ secrets.LUAROCKS_TOKEN }} | ||
| run: | | ||
| if [ -z "$LUAROCKS_TOKEN" ]; then | ||
| echo "LUAROCKS_TOKEN secret is not configured" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ steps.release_env.outputs.version }} | ||
| name: ${{ steps.release_env.outputs.version }} | ||
| draft: false | ||
| prerelease: ${{ steps.release_env.outputs.is_prerelease }} | ||
|
|
||
| - name: Upload to LuaRocks | ||
| env: | ||
| LUAROCKS_TOKEN: ${{ secrets.LUAROCKS_TOKEN }} | ||
| ROCKSPEC_FILE: ${{ steps.verify_rockspec.outputs.rockspec_file }} | ||
| shell: bash | ||
| run: | | ||
| mkdir -p "$HOME/.luarocks" | ||
| chmod 700 "$HOME/.luarocks" | ||
| lua -e 'local token = os.getenv("LUAROCKS_TOKEN"); assert(token and token ~= "", "missing LUAROCKS_TOKEN"); local f = assert(io.open(os.getenv("HOME") .. "/.luarocks/upload_config.lua", "w")); f:write(("key = %q\n"):format(token)); f:write("server = \"https://luarocks.org\"\nversion = \"1.0\"\n"); f:close()' | ||
| chmod 600 "$HOME/.luarocks/upload_config.lua" | ||
| luarocks upload "$ROCKSPEC_FILE" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.