61 lines
2.1 KiB
YAML
61 lines
2.1 KiB
YAML
name: Build release archive
|
|
run-name: ${{ gitea.actor }} starts workflow on tag ${{ gitea.ref_name }}
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Extract tag message
|
|
id: tag_msg
|
|
run: |
|
|
TAG_MSG=$(git tag -l -n99 ${{ gitea.ref_name }} | sed 's/^[v0-9.]\+\s\+//')
|
|
if [ -z "$TAG_MSG" ] || [ "$TAG_MSG" = "$((gitea.ref_name))" ]; then
|
|
TAG_MSG="Automated release ${{ gitea.ref_name }}"
|
|
fi
|
|
|
|
EOF=$(dd if=/dev/urandom bs=15 count=1 2>/dev/null | base64 | tr -dc 'a-zA-Z0-9')
|
|
echo "msg<<$EOF" >> $GITHUB_OUTPUT
|
|
echo "$TAG_MSG" >> $GITHUB_OUTPUT
|
|
echo "$EOF" >> $GITHUB_OUTPUT
|
|
|
|
- name: Extract module ID
|
|
id: get_module_info
|
|
run: |
|
|
MODULE_JSON_PATH=$(find . -type f -name "module.json" -not -path "*/node_modules/*" | head -n 1)
|
|
if [ -z "$MODULE_JSON_PATH" ]; then
|
|
echo "Error: module.json not found"
|
|
exit 1
|
|
fi
|
|
MODULE_ID=$(jq -r '.id' "$MODULE_JSON_PATH")
|
|
echo "module_id=${MODULE_ID}" >> $GITHUB_OUTPUT
|
|
echo "module_json_path=${MODULE_JSON_PATH}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Archive module files
|
|
uses: https://github.com/TheDoctor0/zip-release@0.7.5
|
|
with:
|
|
type: 'zip'
|
|
path: '${{ steps.get_module_info.outputs.module_id }}'
|
|
filename: '${{ steps.get_module_info.outputs.module_id }}.zip'
|
|
exclusions: '/*node_modules/*'
|
|
|
|
- name: Upload archive
|
|
uses: akkuman/gitea-release-action@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ gitea.ref_name }}
|
|
name: "Release ${{ gitea.ref_name }}"
|
|
files: |
|
|
${{ steps.get_module_info.outputs.module_id }}.zip
|
|
${{ steps.get_module_info.outputs.module_json_path }}
|
|
body: ${{ steps.tag_msg.outputs.msg }}
|