Skip to content

Commit 3161163

Browse files
authored
Create release-master.yml
We add automation for creating an installation distribution for publication in a release.
1 parent af30f7d commit 3161163

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release Build
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
build-and-package:
10+
name: Build and Package
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
# 1. Cloning the repository
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
# 2. Install PHP and Composer
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: '8.2'
23+
extensions: mbstring, intl, zip # Укажите нужные расширения
24+
tools: composer
25+
26+
# 3. Installing dependencies
27+
- name: Install dependencies
28+
run: composer install --no-dev --optimize-autoloader
29+
30+
# 4. Creating an archive
31+
- name: Create Release Archive
32+
run: |
33+
zip -r Calendar-${{ github.event.release.tag_name }}.zip ./Calendar -x ".git*" "tests/*" ".github/*"
34+
35+
# 5. Uploading the archive to the release
36+
- name: Upload to Release
37+
uses: actions/upload-release-asset@v1
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
with:
41+
upload_url: ${{ github.event.release.upload_url }}
42+
asset_path: ./Calendar-${{ github.event.release.tag_name }}.zip
43+
asset_name: Calendar-${{ github.event.release.tag_name }}.zip
44+
asset_content_type: application/zip
45+
46+
# 6. Moving the release from preliminary to final
47+
# - name: Finalize Release
48+
# run: |
49+
# curl -X PATCH \
50+
# -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
51+
# -H "Accept: application/vnd.github+json" \
52+
# https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }} \
53+
# -d '{"prerelease": false}'

0 commit comments

Comments
 (0)