Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,30 @@ jobs:
always-auth: true
cache: 'yarn'

- name: Set version
run: |
case ${{ github.event_name }} in
release)
TAG="${{ github.event.release.tag_name }}"
yarn version --no-git-tag-version --new-version "${TAG#v}"
;;
pull_request)
DESCRIBE=$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')
QUALIFIER=$(git describe --tags | grep -Eo '\-g[0-9a-f]+$')
yarn version -s --no-git-tag-version --new-version "${DESCRIBE#v}"
yarn version --no-git-tag-version --prepatch --preid "pr${{ github.event.number }}${QUALIFIER}"
;;
*)
DESCRIBE=$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')
QUALIFIER=$(git describe --tags | grep -Eo '[0-9]+\-g[0-9a-f]+$')
yarn version -s --no-git-tag-version --new-version "${DESCRIBE#v}"
yarn version --no-git-tag-version --prepatch --preid "${{ github.ref_name }}${QUALIFIER}"
;;
esac
VERSION="$(jq -r ".version" < package.json)"
sed -i "s/## Unreleased/## ${VERSION}/" CHANGELOG.md
echo "Version is ${VERSION}"

- name: Build
env:
GITHUB_TOKEN: ${{github.token}}
Expand All @@ -42,9 +66,22 @@ jobs:
with:
name: dist
path: |
./CHANGELOG.md
./package.json
./dist
retention-days: 1

- name: Commit changelog
if: github.event_name == 'release'
run: |
sed -i '3i ## Unreleased\n' CHANGELOG.md
git checkout main
git config user.name github-actions
git config user.email [email protected]
git add CHANGELOG.md
git commit -m "Update CHANGELOG.md after release [skip ci]"
git push

package:
name: Package
runs-on: [ubuntu-latest]
Expand Down Expand Up @@ -73,7 +110,7 @@ jobs:
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: dist
path: dist
path: .

- name: Cache tools
uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.6
Expand Down