[v 0.3.10]: new release of i18n-action #59
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 Workflow | |
on: | |
push: | |
paths: | |
- "dist/index.cjs" | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
- name: Get version from commit message | |
id: version | |
run: echo "::set-output name=version::$(git log -1 --pretty=%B | grep -oP '\[v ([0-9]+\.[0-9]+\.[0-9]+)\]' | sed 's/\[v \|\]//g')" | |
- name: Validate version format | |
run: | | |
if [[ ! "${{ steps.version.outputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "Invalid version format. Aborting the workflow." | |
exit 1 | |
fi | |
- name: Update package.json | |
run: | | |
sed -i "s/\"version\": \".*\"/\"version\": \"${{ steps.version.outputs.version }}\"/" package.json | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "inlang-bot" | |
git add package.json | |
git commit -m "Bump version to ${{ steps.version.outputs.version }}" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: 'dist/*' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body: | | |
Release ${{ steps.version.outputs.version }} | |
tag_name: v${{ steps.version.outputs.version }} |