Fix package.json #1
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 pack | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
release: | |
if: startsWith(github.event.head_commit.message, 'vv') | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
- name: Check commit message | |
id: check_commit_message | |
run: | | |
version=$(git log --format=%B -n 1 ${{ github.sha }}) | |
version=${version:1} | |
version_numeric=${version:1} | |
echo "VERSION=$version" >> $GITHUB_ENV | |
echo "VERSION_NUMERIC=$version_numeric" >> $GITHUB_ENV | |
echo "$VERSION" "$version" | |
if [[ "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "Commit name matches" | |
else | |
echo "Commit name doesnt match" | |
exit 1 | |
fi | |
- name: Install dependencies | |
run: sudo apt update; sudo apt install npm | |
- name: Update package.json and ccmod.json | |
run: | | |
sed -i "s/\"version\": \".*\"/\"version\": \"${VERSION_NUMERIC}\"/" package.json ccmod.json | |
git add package.json ccmod.json | |
- name: Update CHANGELOG.md | |
run: | | |
sed -i "/\[Unreleased\]/a ## [$VERSION_NUMERIC] newDateHere" ./CHANGELOG.md | |
sed -i "s/newDateHere/$(date '+%Y-%m-%d')/g" ./CHANGELOG.md | |
git add ./CHANGELOG.md | |
- name: Commit changes | |
run: | | |
git config --global user.email "${GITHUB_ACTOR_EMAIL}" | |
git config --global user.name "${GITHUB_ACTOR}" | |
git config --global --add safe.directory /github/workspaces | |
git commit -m "$VERSION" | |
git push origin HEAD:master | |
- name: Get Changelog Entry | |
id: changelog_reader | |
uses: mindsers/changelog-reader-action@v2 | |
with: | |
validation_depth: 10 | |
version: ${{ steps.tag_name.outputs.current_version }} | |
path: ./CHANGELOG.md | |
- name: Create and push a new tag | |
run: | | |
git tag -a "$VERSION" -m "Version $VERSION" | |
git push origin "$VERSION" | |
- name: Run pack.sh | |
run: ./pack.sh | |
- name: Create release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
*.ccmod | |
name: ${{ env.VERSION }} | |
tag_name: ${{ env.VERSION }} | |
body: ${{ steps.changelog_reader.outputs.changes }} |