Skip to content

Commit

Permalink
Update actions to use the latest version for the release workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanaken committed Feb 16, 2024
1 parent 8f4efff commit eb9dd8c
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,43 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.javaVersion }}
distribution: ${{ inputs.javaDistribution }}

- name: Update License headers
- name: Update Copyright end year to current year.
run: |
mavenVersion=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout);
echo Update headers.
fd ".java|README.md" | while read -r file; do sed -E -i "s/Copyright ([0-9]{4})-[0-9]{4} (.*)/Copyright \1-$(date +%Y) \2/g" "$file"; done
git status
- name: Update latest release in README
run: |
mavenVersion=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout);
version=${mavenVersion%%-SNAPSHOT};
echo Update headers here.
echo Update README here.
echo Update README.
sed -E -i "s/To use the latest \(.*\) release of Metal/To use the latest \($version\) release of Metal/g" README.md
sed -E -i "s#<version>.*</version>#<version>$version</version>#g" README.md
git status
- name: Commit Changes
run: |
git config --global user.name 'Your Name'
git config --global user.email '[email protected]'
git commit -am "Update license headers and README.md."
git push
- name: Release prepare
run: mvn -B release:prepare release:clean
Expand All @@ -67,7 +82,7 @@ jobs:

# See an example here how artifacts are published : https://github.com/actions/setup-java/blob/v3.11.0/docs/advanced-usage.md#Publishing-using-Apache-Maven
- name: Set up Apache Maven Central
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
java-version: ${{ inputs.javaVersion }}
distribution: ${{ inputs.javaDistribution }}
Expand Down

0 comments on commit eb9dd8c

Please sign in to comment.