mirror of
https://github.com/grocy/grocy.git
synced 2026-03-27 23:29:25 +01:00
This commit addresses two issues in the release workflow: 1. The tag trigger has been reverted to only accept tags matching the `v*.*.*` pattern, as requested by the user. 2. The `grep` command used to extract the version number from `version.json` has been made more robust to prevent errors during the workflow run.
66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*.*.*'
|
|
|
|
jobs:
|
|
release:
|
|
name: Create Release
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.2'
|
|
extensions: mbstring, intl, gd, sqlite3, pdo_sqlite, zip, bcmath
|
|
coverage: none
|
|
|
|
- name: Get Composer Cache Directory
|
|
id: composer-cache
|
|
run: |
|
|
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-composer-
|
|
|
|
- name: Install Composer dependencies
|
|
run: composer install --no-interaction --no-progress --no-suggest --no-dev --optimize-autoloader
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '20'
|
|
cache: 'yarn'
|
|
|
|
- name: Install Node.js dependencies
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Get version
|
|
id: get_version
|
|
run: |
|
|
VERSION=$(grep -oP '(?<="version": ")[^"]*' version.json)
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
|
|
- name: Build release package
|
|
run: |
|
|
chmod +x release.sh
|
|
./release.sh
|
|
|
|
- name: Create Release and Upload Asset
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: "grocy_${{ env.VERSION }}.zip"
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|