-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f69eb5
commit 259ea89
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Create release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version' | ||
required: true | ||
default: '' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
cache: 'npm' | ||
|
||
- name: Bump version | ||
run: | | ||
new_version="${{ inputs.version }}" | ||
sed -i "s/\"version\": \".*\"/\"version\": \"$new_version\"/g" composer.json | ||
sed -i "s/\"version\": \".*\"/\"version\": \"$new_version\"/g" package.json | ||
sed -i "s/Version:.*$/Version: $new_version/g" prompress.php | ||
sed -i "s/define( 'PROMPRESS_VERSION', '.*' );/define( 'PROMPRESS_VERSION', '$new_version' );/g" prompress.php | ||
composer update --lock --ignore-platform-reqs --no-install | ||
npm install --package-lock-only | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "github-actions@github.com" | ||
git add composer.json composer.lock package.json package-lock.json dekode-gtm-plugin.php | ||
git commit -m "Bump version to $new_version" | ||
git push origin HEAD:main | ||
- name: Install NPM dependencies | ||
run: npm ci | ||
|
||
- name: Get changelog entries | ||
id: changelog | ||
run: | | ||
changelog=$(git log --oneline $(git describe --tags --abbrev=0 @^)..@) | ||
echo $changelog | ||
echo "changes=$changelog" >> $GITHUB_OUTPUT | ||
- name: Build dependencies | ||
run: npm run build | ||
|
||
- name: Prepare build repository | ||
run: | | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "github-actions@github.com" | ||
git checkout -b "release/${{ inputs.version }}" | ||
git add -f build/* | ||
git rm -r .github/ | ||
git rm -r local/ | ||
git rm -r node_modules/ | ||
git rm -r src/ | ||
git rm -r .gitignore | ||
git rm package.json | ||
git rm package-lock.json | ||
git rm phpcs.xml.dist | ||
git commit -m "Release ${{ inputs.version }}" | ||
git tag "${{ inputs.version }}" | ||
git push --tags | ||
- name: Create Github release | ||
id: create_github_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ inputs.version }} | ||
release_name: Release ${{ inputs.version }} | ||
draft: false | ||
body: ${{ steps.changelog.outputs.changes }} | ||
prerelease: false |