Skip to content

Create a GH pre-release #132

Create a GH pre-release

Create a GH pre-release #132

name: "Create a GH pre-release"
# This action will run when it is triggered manually
on:
workflow_dispatch:
inputs:
releaseVersion:
description: 'The release version for testing (e.g. 4.5.0-test-2 for prerelease during week 2)'
required: true
type: string
defaults:
run:
shell: bash
jobs:
create-release:
name: "Create the pre-release"
runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ inputs.releaseVersion }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Set up repository"
uses: ./.github/actions/setup-repo
- name: "Create a test branch"
id: create_branch
uses: ./.github/actions/create-branch
with:
version: ${{ env.RELEASE_VERSION }}
- name: "Generate the changelog"
id: generate_changelog
uses: ./.github/actions/process-changelog
with:
release-version: ${{ steps.create_branch.outputs.trimmed-version }}
- name: "Bump version header"
env:
VERSION: ${{ steps.create_branch.outputs.trimmed-version }}
run: |
sed -i "s/^ \* Version: .*$/ * Version: $VERSION/" woocommerce-payments.php
- name: "Commit and push changes"
env:
BRANCH_NAME: ${{ steps.create_branch.outputs.branch-name }}
RELEASE_VERSION: ${{ steps.create_branch.outputs.trimmed-version }}
uses: ./.github/actions/commit-push-as-bot
with:
release-version: ${{ env.RELEASE_VERSION }}
branch: ${{ env.BRANCH_NAME }}
- name: "Create a test tag"
id: create_tag
uses: ./.github/actions/create-tag
with:
version: ${{ env.RELEASE_VERSION }}
- name: "Build the plugin"
id: build_plugin
uses: ./.github/actions/build
- name: "Create GH pre-release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHANGELOG: ${{ steps.generate_changelog.outputs.changelog }}
TAG_MESSAGE: ${{ steps.create_tag.outputs.tag-message }}
VERSION: ${{ steps.create_tag.outputs.trimmed-version }}
FILENAME: ${{ steps.build_plugin.outputs.release-filename }}
run: |
RELEASE_NOTES=$(echo -e "${CHANGELOG}")
gh release create $VERSION --notes "$RELEASE_NOTES" --title "$TAG_MESSAGE" --target "develop" "--prerelease" $FILENAME
- name: "Trigger translations update on GlotPress"
uses: ./.github/actions/trigger-translations
with:
release-version: ${{ steps.create_tag.outputs.trimmed-version }}
glotpress-url: ${{ secrets.GLOTPRESS_IMPORT_URL }}