Skip to content

chore: bump version (#121) #73

chore: bump version (#121)

chore: bump version (#121) #73

Workflow file for this run

name: release
on:
push:
tags: ["v[0-9].[0-9]+.[0-9]+"]
permissions:
contents: write
pull-requests: write
jobs:
build_foxe:
name: build_foxe
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: yarn install
- name: Package
run: yarn run package
- name: Extract version
id: extract_version
run: |
version=$(node -p "require('./package.json').version")
echo "version=$version" >> $GITHUB_ENV
- name: Update changelog file
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
yarn commitizen init cz-conventional-changelog --save-dev --force --save-exact
HEADER=$(awk 'NR==1 {print; exit}' CHANGELOG.md)
yarn conventional-changelog -p angular -o TEMP.md -r 0
echo "$HEADER" > CHANGELOG.md
echo "" >> CHANGELOG.md
cat TEMP.md >> CHANGELOG.md
rm TEMP.md
- name: Fetch initial commit history
id: fetch_initial_commit_history
run: |
INITIAL_COMMIT_HISTORY=$(cat initial_commit_history.md)
echo "INITIAL_COMMIT_HISTORY<<EOF" >> $GITHUB_ENV
echo "$INITIAL_COMMIT_HISTORY" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Insert initial commit history
run: |
TARGET_TAG="0.0.1"
FILE="CHANGELOG.md"
INITIAL_COMMIT_HISTORY="${{ env.INITIAL_COMMIT_HISTORY }}"
if grep -q "^## $TARGET_TAG " "$FILE"; then
sed -i "/^## $TARGET_TAG /,/^## /{//!d}" "$FILE"
awk -v content="$INITIAL_COMMIT_HISTORY" -v tag="## $TARGET_TAG " '
BEGIN { found=0 }
$0 ~ tag { print; print content; found=1; next }
{ print }
END { if (!found) print "Tag header not found!" }
' "$FILE" > TEMP.md && mv TEMP.md "$FILE"
echo "Initial commit history inserted under the ## $TARGET_TAG header in $FILE."
else
echo "Tag ## $TARGET_TAG not found in $FILE."
fi
- name: Commit changelog changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add --all
git commit -s -m "chore: update changelog for $GITHUB_REF"
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
- name: Download ScanCode Toolkit
run: |
curl -L -o scancode-toolkit.tar.gz https://github.com/aboutcode-org/scancode-toolkit/releases/download/v32.3.0/scancode-toolkit-v32.3.0_py3.12-linux.tar.gz
mkdir -p scancode-toolkit
tar -xzf scancode-toolkit.tar.gz -C scancode-toolkit --strip-components=1
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Run ScanCode
run: |
cd scancode-toolkit
./scancode --json-pp ../scancode-result.json ../
- name: Create GitHub Release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
id: create_release
uses: "plu5/automatic-releases-with-sha-action@main"
with:
repo_token: "${{ secrets.PAT_TOKEN }}"
prerelease: false
title: ASAM OSI Converter ${{ env.version }}
files: |
CHANGELOG.md
scancode-result.json
lichtblick.asam-osi-converter-${{ env.version }}.foxe
- name: Upload CHANGELOG as artifact
uses: actions/upload-artifact@v4
with:
name: changelog
path: ./CHANGELOG.md
create_pull_request:
name: Create Pull Request
needs: build_foxe
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0
- name: Download changelog artifact
uses: actions/download-artifact@v4
with:
name: changelog
path: ./
- name: Create a Pull Request to update the changelog file
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.PAT_TOKEN }}
commit-message: "docs: update CHANGELOG for release"
branch: "update-changelog"
title: "Update CHANGELOG for new release"
body: "This pull request updates the CHANGELOG file with details of the new release."
base: "main"
delete-branch: true