Skip to content

Release

Release #73

Workflow file for this run

---
name: Release
on:
workflow_dispatch:
inputs:
versionName:
description: 'Version (falls back to the next version available)'
required: false
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: "Get latest GitHub Release"
id: last_release
uses: InsonusK/[email protected]
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
view_top: 1
- name: Initialize mandatory git config
run: |
git config user.name "GitHub Actions"
git config user.email [email protected]
- name: Increase version
id: increase_version
run: |
CUR_V=${{ steps.last_release.outputs.tag_name }}
LAST_VERSION=$(sed 's/[^0-9.]//g' <<< "$CUR_V")
echo "Latest version -> $LAST_VERSION"
NEXT_VERSION=$(echo $LAST_VERSION | awk -F. -v OFS=. '{$NF += 1 ; print}')
echo "version=$NEXT_VERSION" >> "$GITHUB_OUTPUT"
- name: Next GitHub version
run: echo "Version increased -> ${{ steps.increase_version.outputs.version }}"
- name: Set version
id: set_version
run: |
if [ "${{ github.event.inputs.versionName }}" == "" ]; then
echo "version=${{ steps.increase_version.outputs.version }}" >> "$GITHUB_OUTPUT"
else
echo "version=${{ github.event.inputs.versionName }}" >> "$GITHUB_OUTPUT"
fi
- name: Maybe bump version
id: "bump_version"
run: |
# make file runnable, might not be necessary
chmod +x "bin/bump-version.sh"
echo "VERSION=$(bin/bump-version.sh -s -v ${{ steps.set_version.outputs.version }})" >> "$GITHUB_OUTPUT"
- name: Validate version
run: echo "Next release version will be -> ${{ steps.bump_version.outputs.VERSION }}"
- name: Commit version
id: commit_version
run: |
git add .
git diff-index --quiet HEAD || git commit -m 'Version bump' --no-verify && git push -f
- name: Create release branch
run: git checkout -b release/v${{ steps.bump_version.outputs.VERSION }}
- name: Bump composer.json version
id: "bump_composer_version"
run: |
echo "VERSION=$(bin/bump-version.sh -s -c -v ${{ steps.bump_version.outputs.VERSION }})"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick
ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
coverage: xdebug #optional, setup coverage driver
- name: Composer install
run: composer install --no-dev && composer dump-autoload
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Build Project
run: |
npm install
npm run build
- name: Commit build
id: make-commit
run: |
git add vendor/. --force
git add build/. --force
git add .
git commit -m "Adding /vendor + /build directory to release" --no-verify
- name: Push new branch
run: git push origin release/v${{ steps.bump_version.outputs.VERSION }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.bump_version.outputs.VERSION }}
release_name: ${{ steps.bump_version.outputs.VERSION }}
body: "Release of version ${{ steps.bump_version.outputs.VERSION }}. See readme.txt for details."
draft: false
prerelease: false
commitish: release/v${{ steps.bump_version.outputs.VERSION }}
- name: Remove branch
run: git checkout master && git branch -D release/v${{ steps.bump_version.outputs.VERSION }} && git push origin --delete release/v${{ steps.bump_version.outputs.VERSION }}
env:
NODE_VERSION: "16.x"
APP_VERSION: "1.10.O"