Release #14
Workflow file for this run
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
name: Release Packages | ||
on: | ||
release: | ||
types: [published] | ||
env: | ||
NODE_VERSION: '20.16.0' | ||
PHP_VERSION: '8.2.22' | ||
# RELEASE_TITLE_ENV: 'v1.0.9-beta' | ||
# RELEASE_TAG_ENV: '1.0.9-beta' | ||
permissions: | ||
contents: write | ||
defaults: | ||
run: | ||
working-directory: ./krait-ui | ||
jobs: | ||
build_ui: | ||
runs-on: 'ubuntu-20.04' | ||
name: Build UI | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Get release title and tag | ||
id: get_version_details | ||
run: | | ||
echo "RELEASE_TITLE=${{ github.event.release.name }}" >> $GITHUB_ENV | ||
echo "RELEASE_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | ||
# - name: Get release title and tag | ||
# id: get_version_details | ||
# run: | | ||
# echo "RELEASE_TITLE=${{ env.RELEASE_TITLE_ENV }}" >> $GITHUB_ENV | ||
# echo "RELEASE_TAG=${{ env.RELEASE_TAG_ENV }}" >> $GITHUB_ENV | ||
- name: Check release title format | ||
run: | | ||
if [[ -z "$RELEASE_TITLE" ]]; then | ||
echo "Release title cannot be empty" | ||
exit 1 | ||
fi | ||
TITLE_VERSION_REGEX="^v[0-9]+\.[0-9]+\.[0-9]+(-alpha|-beta)?$" | ||
if [[ ! $RELEASE_TITLE =~ $TITLE_VERSION_REGEX ]]; then | ||
echo "Invalid release title format: $RELEASE_TITLE" | ||
exit 1 | ||
else | ||
echo "Release title $RELEASE_TITLE is valid" | ||
fi | ||
- name: Check release tag format | ||
run: | | ||
if [[ -z "$RELEASE_TAG" ]]; then | ||
echo "Release tag cannot be empty" | ||
exit 1 | ||
fi | ||
TAG_VERSION_REGEX="^[0-9]+\.[0-9]+\.[0-9]+(-alpha|-beta)?$" | ||
if [[ ! $RELEASE_TAG =~ $TAG_VERSION_REGEX ]]; then | ||
echo "Invalid release tag format: $RELEASE_TAG" | ||
exit 1 | ||
else | ||
echo "Release tag $RELEASE_TAG is valid" | ||
fi | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Commit version bump in different branch | ||
id: create-release-branch | ||
run: | | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config user.name "github-actions[bot]" | ||
git checkout -b version-bump/$RELEASE_TAG | ||
git commit -am "Bump version to $RELEASE_TAG" | ||
git push origin version-bump/$RELEASE_TAG | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Retrieve the npm dependencies cache | ||
uses: actions/cache@v4 | ||
id: node-modules-cache | ||
with: | ||
path: node_modules | ||
key: npm-dependencies-${{ runner.os }}-${{ hashFiles('./krait/package-lock.json') }} | ||
restore-keys: | | ||
npm-dependencies-${{ hashFiles('./krait/package-lock.json') }} | ||
npm-dependencies- | ||
- name: Install npm dependencies | ||
if: steps.node-modules-cache.outputs.cache-hit != 'true' | ||
run: npm ci | ||
- name: Update package.json version | ||
id: update-package-version | ||
run: | | ||
npm version $RELEASE_TAG | ||
- name: Build UI | ||
id: build-ui-job | ||
run: npm run build | ||
- name: Commit version bump in different branch | ||
id: create-release-branch | ||
Check failure on line 110 in .github/workflows/release.yml GitHub Actions / Release PackagesInvalid workflow file
|
||
run: | | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config user.name "github-actions[bot]" | ||
git checkout -b version-bump/$RELEASE_TAG | ||
git commit -am "Bump version to $RELEASE_TAG" | ||
git push origin version-bump/$RELEASE_TAG | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
branch: version-bump/$RELEASE_TAG | ||
title: "Bump version to $RELEASE_TAG" | ||
body: "This PR bumps the version to $RELEASE_TAG." | ||
base: main | ||
labels: | | ||
automated pr | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Auto merge PR | ||
uses: "pascalgn/[email protected]" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
- name: feedback | ||
if: ${{ steps.automerge.outputs.mergeResult == 'merged' }} | ||
run: | | ||
echo "Pull request ${{ steps.automerge.outputs.pullRequestNumber }} merged!" | ||
# - name: Publish the NPM package | ||
# run: npm publish --access public | ||
# env: | ||
# NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |