Merge pull request #41 from planeur-net/feature/merge_ffvp #21
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: 1 - Add version to france.txt | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "master" branch | |
push: | |
branches: | |
- main | |
paths: | |
- 'france.txt' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
add-version: | |
if: ${{ github.ref == 'refs/heads/main' }} | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Clone this repo | |
uses: actions/checkout@v3 | |
# Add version information to france.txt | |
- name: Get info, delete 1st line if applicable, add info | |
run: | | |
# Get information | |
git log --pretty="%h %cI" -n1 -- france.txt | |
versionInfo=$(git log --pretty="%h %cI" -n1 -- france.txt) | |
# Remove first line if applicable | |
sed -i "$((grep -nm1 *version= ./france.txt || echo 1000000000:) | cut -f 1 -d:) d" ./france.txt | |
# Add version information | |
sed -i "1i *version= $versionInfo" ./france.txt | |
# Push changes to repo | |
- name: Push changes into repo | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Automated Change | |
file_pattern: 'france.txt' |