Skip to content

Create Release

Create Release #204

name: Create Release
on:
workflow_dispatch:
inputs:
version:
description: The version to tag and release
required: true
pre_release:
description: Is this a pre-release?
required: false
default: false
type: boolean
make_latest:
description: Should this be made the latest release?
required: false
default: false
type: boolean
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_DISPATCH_TOKEN }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Create Tag
run: |
git config user.name github-actions
git config user.email [email protected]
sed -i "/version: /d" az_quickstart.info.yml
echo -e "version: ${{ github.event.inputs.version }}" >> az_quickstart.info.yml
git add az_quickstart.info.yml
git commit -m "Preparing to tag ${{ github.event.inputs.version }}."
git push
git tag ${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}
- name: Build project # This would actually build your project, using zip for an example artifact
run: |
git clone -b 2.12.x https://github.com/az-digital/az-quickstart-scaffolding.git az_quickstart
cd az_quickstart
composer config repositories.az_quickstart vcs https://github.com/az-digital/az_quickstart.git
composer config use-github-api false
composer require --no-update az-digital/az_quickstart:${{ github.event.inputs.version }}
composer install --no-dev -o
- name: Zip Assets
run: |
zip -r -x\*.git* az_quickstart.zip az_quickstart
- name: Tar Assets
run: |
tar --exclude '*.git*' -c -z -f az_quickstart.tar.gz az_quickstart
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.event.inputs.version }}
name: ${{ github.event.inputs.version }}
draft: false
make_latest: ${{ github.event.inputs.make_latest }}
prerelease: ${{ github.event.inputs.pre_release }}
files: |
./az_quickstart.zip
./az_quickstart.tar.gz
- name: Remove version from info file
run: |
git config user.name github-actions
git config user.email [email protected]
sed -i "/version: /d" az_quickstart.info.yml
git add az_quickstart.info.yml
git commit -m "Back to dev."
git push
dispatch:
needs: build
strategy:
matrix:
repo:
- az-digital/az-quickstart-pantheon
runs-on: ubuntu-latest
steps:
- name: Notify dependencies
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_DISPATCH_TOKEN }}
repository: ${{ matrix.repo }}
event-type: az_quickstart_release
client-payload: '{"version": "${{ github.event.inputs.version }}", "make_latest": "${{ github.event.inputs.make_latest }}"}'