Skip to content

Commit

Permalink
release action
Browse files Browse the repository at this point in the history
  • Loading branch information
rahmanramsi committed Nov 1, 2024
1 parent 4456b44 commit c416f9a
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build & Draft Release

on:
push:
tags:
- '*.*.*'

jobs:
build-and-release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, gd, iconv, json, mbstring, pdo

- name: Install PHP dependencies
run: composer install --no-ansi --no-dev --no-interaction --no-plugins --no-progress --optimize-autoloader

- name: Prepare repository in a single folder with repository name
run: |
mkdir -p ./release/${{ github.event.repository.name }}
rsync -av --progress ./ ./release/${{ github.event.repository.name }} --exclude release --exclude .git --exclude node_modules --exclude tests --exclude .github
- name: Create zip archive
run: |
cd release
zip -r plugin.zip ./${{ github.event.repository.name }}
ls -l plugin.zip
if [ ! -f plugin.zip ]; then
echo "Error: plugin.zip was not created"
exit 1
fi
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: true
prerelease: false
generate_release_notes: true


- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release/plugin.zip
asset_name: ${{github.event.repository.name}}-${{ github.ref_name }}.zip
asset_content_type: application/zip

0 comments on commit c416f9a

Please sign in to comment.