Update year #12
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: Update year | |
on: | |
workflow_dispatch: | |
inputs: | |
aoc_year: | |
description: 'Advent of Code year' | |
required: true | |
default: 'yyyy' | |
jobs: | |
update-year: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Year Format | |
run: | | |
if echo "${{ github.event.inputs.aoc_year }}" | grep -E -q '^[0-9]{4}$'; then | |
echo "Year '${{ github.event.inputs.aoc_year }}' format is valid." | |
else | |
echo "Error: Invalid year format. Please provide a valid 4-digit year." | |
exit 1 | |
fi | |
- uses: actions/checkout@v3 | |
- name: Update README.md | |
run: | | |
find . -name 'README.md' | xargs sed -i 's/{year}/'${{ github.event.inputs.aoc_year }}'/g' | |
- name: Update pom.xml | |
run: | | |
find . -name 'pom.xml' | xargs sed -i 's/yyyy/'${{ github.event.inputs.aoc_year }}'/g' | |
- name: Check changes | |
run: | | |
cat "src/main/java/com/adventofcode/flashk/day01/README.md" | |
cat "pom.xml" | |