Skip to content

Update main.yml

Update main.yml #13

Workflow file for this run

name: πŸš€ Build and Release
on:
push:
branches:
- cicd
pull_request:
branches:
- master
jobs:
build:
name: Build 🌐
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: Build Vendor
run: |
composer install --no-interaction --optimize-autoloader
- name: Compress Vendor
uses: vimtor/[email protected]
with:
files: vendor/
recursive: false
dest: vendor.zip
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: vendor
path: vendor.zip
- name: Get version from composer.json
id: get_version
run: |
VERSION=$(jq -r .version composer.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
outputs:
version: ${{ steps.get_version.outputs.version }}
release:
name: Create Release πŸš€
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Artifact
uses: actions/download-artifact@v2
with:
name: vendor
path: .
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.build.outputs.version }}
release_name: ${{ needs.build.outputs.version }}
draft: false
prerelease: false
- name: Upload Release Asset
id: 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: ./vendor.zip
asset_name: vendor.zip
asset_content_type: application/zip