mirror of
https://github.com/grocy/grocy.git
synced 2026-03-28 07:39:25 +01:00
This commit adds the 'permissions: contents: write' block to the release workflow. This is necessary to allow the workflow to create a GitHub release and upload assets. This follows the principle of least privilege by only granting write permissions to the workflow that needs it.
64 lines
1.7 KiB
YAML
64 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: echo "VERSION=$(grep -o '\"version\": \"[^\"]*' version.json | grep -o '[^"]*$')" >> $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 }}
|