Skip to content

Commit

Permalink
Add new manual workflow to test
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBooker committed May 15, 2024
1 parent 2f69eb5 commit 259ea89
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/manual-release.yml
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

0 comments on commit 259ea89

Please sign in to comment.