Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Release from Version Tags | |
on: | |
push: | |
tags: ["v*"] | |
jobs: | |
build: | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | |
runs-on: ubuntu-22.04 | |
name: Build Release | |
steps: | |
# https://github.com/marketplace/actions/checkout | |
- uses: actions/checkout@v3 | |
- name: Set up REPO and TAG environment vars | |
run: | | |
echo "REPO=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV | |
echo "TAG=${GITHUB_SHA:0:6}" >> $GITHUB_ENV | |
- name: This run was triggered by a version tag, reset the $TAG variable to the tag name | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
echo "TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Install PHP dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Create Zip archive with `composer archive` | |
run: | | |
composer archive -f zip --dir=../ --file=${REPO} | |
- name: Create GitHub release | |
if: ${{ contains(github.ref, 'refs/tags/') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create v${TAG} ../${REPO}.zip |