https://github.com/udondan/ver2doc
https://github.com/udondan/ver2doc
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/udondan/ver2doc
- Owner: udondan
- License: mit
- Created: 2020-04-10T09:57:11.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-06-13T06:20:00.000Z (over 5 years ago)
- Last Synced: 2025-03-24T23:33:21.725Z (7 months ago)
- Language: Shell
- Size: 64.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ver2Doc
Ver2Doc is a helper to update version references in your documentation.
It expects your version to be stored in the file `VERSION` in the root of the repository.
The action needs to be called for every single file and requires to provide a reges patter to match against.
```yaml
- name: Step 1
uses: udondan/ver2doc@v1.0.1
with:
FILE: some.file
PATTERN: [0-9.]+
```You can use back references, which then of course requires you to also provide a replacement string.
```yaml
- name: Step 2
uses: udondan/ver2doc@v1.0.1
with:
FILE: some.file
PATTERN: (udondan/ver2doc\@v)[0-9.]+
REPLACE: \${1}${VERSION}
```Complete example usage in conjunction with [actions/checkout](https://github.com/marketplace/actions/checkout):
```yaml
---
on:
push:
paths:
- VERSIONjobs:
set-version:
runs-on: ubuntu-lateststeps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 1- name: Update Readme
uses: udondan/ver2doc@v1.0.1
with:
FILE: README.md
PATTERN: (udondan/ver2doc\@v)[0-9.]+
REPLACE: \${1}${VERSION}- name: Update Action
uses: udondan/ver2doc@v1.0.1
with:
FILE: action.yml
PATTERN: (udondan/ver2doc:)[0-9.]+
REPLACE: \${1}${VERSION}- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git diff --exit-code || git commit -m "Updates version references" -a- name: Push changes
run: >
[[ "${{ github.ref }}" == refs/tags/* ]] ||
git push "https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git" HEAD:${{ github.ref }}
```