88 lines
2.4 KiB
YAML
88 lines
2.4 KiB
YAML
name: Telegram Mini App Shop Builder
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
module-build:
|
|
name: Build module.
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP 7.4
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '7.4'
|
|
tools: composer
|
|
|
|
- name: Build module
|
|
run: |
|
|
bash scripts/ci/build.sh "${GITHUB_WORKSPACE}"
|
|
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: oc_telegram_shop.ocmod.zip
|
|
path: ./build/oc_telegram_shop.ocmod.zip
|
|
retention-days: 1
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: [module-build]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # to fetch tags
|
|
|
|
- name: Extract latest tag and set filename
|
|
id: meta
|
|
run: |
|
|
# Last stable tag.
|
|
LAST_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
|
|
|
|
# Fallback
|
|
if [ -z "$LAST_TAG" ]; then
|
|
LAST_TAG="v0.0.0"
|
|
fi
|
|
|
|
echo "Last Tag: $LAST_TAG"
|
|
SHORT_SHA=$(git rev-parse --short=7 HEAD)
|
|
DATE=$(date +%Y%m%d%H%M)
|
|
TAG="${LAST_TAG}-dev.${DATE}+${SHORT_SHA}"
|
|
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
|
echo "filename=oc_telegram_shop_${TAG}.ocmod.zip" >> $GITHUB_OUTPUT
|
|
|
|
- name: Download build artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: oc_telegram_shop.ocmod.zip
|
|
path: ./build
|
|
|
|
- name: Rename artifact file
|
|
run: mv ./build/oc_telegram_shop.ocmod.zip ./build/${{ steps.meta.outputs.filename }}
|
|
|
|
- name: Delete existing GitHub release and tag
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
TAG=${{ steps.meta.outputs.tag }}
|
|
echo "⛔ Deleting existing release and tag (if any): $TAG"
|
|
gh release delete "$TAG" --cleanup-tag --yes || true
|
|
git push origin ":refs/tags/$TAG" || true
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
draft: true
|
|
tag_name: ${{ steps.meta.outputs.tag }}
|
|
files: ./build/${{ steps.meta.outputs.filename }}
|
|
generate_release_notes: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|