-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Actions for Release / Dep Updates / Verify / ... (#79)
* Added stubs for actions * Reusable actions do not work.
- Loading branch information
Showing
5 changed files
with
286 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Maven Dependency Updates | ||
|
||
on: | ||
schedule: | ||
- cron: "00 15 * * 1" | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
env: | ||
INSTRUCTOR_USER: "instructor_e2e" | ||
INSTRUCTOR_PASSWORD: ${{ secrets.INSTRUCTOR_PASSWORD }} | ||
STUDENT_USER: "student_e2e" | ||
ARTEMIS_URL: "https://artemis-test.sdq.kastel.kit.edu" | ||
COURSE_ID: "4" | ||
PROGRAMMING_EXERCISE_ID: "41" | ||
|
||
jobs: | ||
pre_job: | ||
name: "Check for duplicate jobs" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
steps: | ||
- id: skip_check | ||
uses: fkirc/skip-duplicate-actions@master | ||
with: | ||
concurrent_skipping: 'same_content_newer' | ||
skip_after_successful_duplicate: 'true' | ||
|
||
build: | ||
needs: pre_job | ||
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | ||
name: "Check for Updates" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
|
||
- uses: joshlong/java-version-export-github-action@v28 | ||
id: jve | ||
|
||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ steps.jve.outputs.java_major_version }} | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
|
||
- name: Update Dependencies | ||
shell: bash | ||
run: | | ||
mvn -U -B versions:update-parent versions:update-properties versions:update-parent versions:update-child-modules versions:use-latest-releases -DgenerateBackupPoms=false | tee /tmp/updates-raw.txt | ||
mvn -U -B verify | ||
echo 'Auto-Update Dependencies' > /tmp/updates.txt | ||
cat /tmp/updates-raw.txt | grep 'Updat' | sort | uniq | cut -d ' ' -f 2- >> /tmp/updates.txt || true | ||
echo 'Setting commit message to ..' | ||
cat /tmp/updates.txt | ||
- name: Check if there are changes | ||
id: changes | ||
run: echo "changed=$(git status --porcelain | wc -l)" >> $GITHUB_OUTPUT | ||
|
||
- name: Commit Changes of Versions | ||
if: steps.changes.outputs.changed != 0 | ||
shell: bash | ||
run: | | ||
git config --global user.email "action@github.com" | ||
git config --global user.name "GitHub Action" | ||
git add . && git commit -F /tmp/updates.txt | ||
- name: Push Changes | ||
uses: ad-m/github-push-action@master | ||
if: steps.changes.outputs.changed != 0 | ||
with: | ||
# See https://github.com/orgs/community/discussions/25702 and https://github.com/orgs/community/discussions/26220 | ||
github_token: ${{ secrets.PAT }} | ||
branch: ${{ github.ref }} | ||
tags: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Maven Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' # Build the latest develop-SNAPSHOT | ||
paths: | ||
- '**/src/**' | ||
- '**/pom.xml' | ||
- 'pom.xml' | ||
|
||
# Publish `v1.2.3` tags as releases. | ||
tags: | ||
- v* | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
env: | ||
INSTRUCTOR_USER: "instructor_e2e" | ||
INSTRUCTOR_PASSWORD: ${{ secrets.INSTRUCTOR_PASSWORD }} | ||
STUDENT_USER: "student_e2e" | ||
ARTEMIS_URL: "https://artemis-test.sdq.kastel.kit.edu" | ||
COURSE_ID: "4" | ||
PROGRAMMING_EXERCISE_ID: "41" | ||
|
||
jobs: | ||
pre_job: | ||
name: "Check for duplicate jobs" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
steps: | ||
- id: skip_check | ||
uses: fkirc/skip-duplicate-actions@master | ||
with: | ||
concurrent_skipping: 'same_content_newer' | ||
skip_after_successful_duplicate: 'true' | ||
|
||
build: | ||
needs: pre_job | ||
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | ||
name: "Build and/or Deploy" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: joshlong/java-version-export-github-action@v28 | ||
id: jve | ||
|
||
- name: Java without Cache | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ steps.jve.outputs.java_major_version }} | ||
distribution: 'temurin' | ||
|
||
- name: Maven Verify | ||
shell: bash | ||
run: mvn -U -B verify | ||
|
||
- name: Set maven settings.xml | ||
uses: whelk-io/maven-settings-xml-action@v22 | ||
with: | ||
servers: '[{ "id": "ossrh", "username": "${{ secrets.OSSRH_USER }}", "password": "${{ secrets.OSSRH_TOKEN }}" }]' | ||
|
||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_KEY }} | ||
|
||
- name: Publish Package | ||
shell: bash | ||
run: mvn -DskipTests -P deployment -U -B deploy |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Maven Release (Manual) | ||
|
||
on: | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
inputs: | ||
release-version: | ||
type: string | ||
description: The version for release. E.g., "1.2.3" | ||
required: true | ||
next-version: | ||
type: string | ||
description: The version after release. E.g., "2.0.0-SNAPSHOT" | ||
required: true | ||
|
||
env: | ||
INSTRUCTOR_USER: "instructor_e2e" | ||
INSTRUCTOR_PASSWORD: ${{ secrets.INSTRUCTOR_PASSWORD }} | ||
STUDENT_USER: "student_e2e" | ||
ARTEMIS_URL: "https://artemis-test.sdq.kastel.kit.edu" | ||
COURSE_ID: "4" | ||
PROGRAMMING_EXERCISE_ID: "41" | ||
|
||
jobs: | ||
build: | ||
name: "Trigger new Release" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
|
||
- uses: joshlong/java-version-export-github-action@v28 | ||
id: jve | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: ${{ steps.jve.outputs.java_major_version }} | ||
|
||
- name: Prepare GIT | ||
shell: bash | ||
run: | | ||
git config --global user.email "action@github.com" | ||
git config --global user.name "GitHub Action" | ||
- name: Bump to Release, Verify, Bump to Next Version, and Verify | ||
shell: bash | ||
run: | | ||
# Download version update script to tmp directory | ||
curl -s https://raw.githubusercontent.com/kit-sdq/actions/main/scripts/maven-version-update.sh > /tmp/maven-version-update.sh | ||
chmod +x /tmp/maven-version-update.sh | ||
echo "######### Content of maven-version-update.sh #########" | ||
cat /tmp/maven-version-update.sh | ||
echo "######################################################" | ||
echo "######### Running maven-version-update.sh ###########" | ||
RELEASE_VERSION=${{ inputs.release-version }} NEXT_VERSION=${{ inputs.next-version }} AUTO_DIGIT=Patch bash /tmp/maven-version-update.sh | ||
echo "######################################################" | ||
- name: Push Changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
# See https://github.com/orgs/community/discussions/25702 and https://github.com/orgs/community/discussions/26220 | ||
github_token: ${{ secrets.PAT }} | ||
branch: ${{ github.ref }} | ||
tags: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Create Release | ||
on: | ||
workflow_dispatch: | ||
push: | ||
# Publish `v1.2.3` tags as releases. | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
pre_job: | ||
name: "Check for duplicate jobs" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
steps: | ||
- id: skip_check | ||
uses: fkirc/skip-duplicate-actions@master | ||
with: | ||
concurrent_skipping: 'same_content_newer' | ||
skip_after_successful_duplicate: 'true' | ||
|
||
release: | ||
needs: pre_job | ||
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | ||
name: "Create new GitHub Release" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Create Changelog | ||
shell: bash | ||
run: | | ||
DIFF=$(git log $(git tag --sort=-creatordate | sed '2q;d')..HEAD --oneline) | ||
if [ -z "$DIFF" ]; then | ||
echo "Defaulting to full log" | ||
DIFF=$(git log --oneline) | ||
fi | ||
echo "# Commits since last release" > CHANGELOG.txt | ||
echo "$DIFF" | sed 's/^/* /' | sed '/Auto-Update Dependencies/{s/Updated\|Updating/\n\t* Updated/g}' | sed '/\[maven-release-plugin\]/d' | sed '/Merge branch/d' | sed '/Prepare for next development cycle/d' | sed -r '/.*\(#\w+\)$/d' >> CHANGELOG.txt | ||
- uses: softprops/action-gh-release@v2 | ||
with: | ||
body_path: CHANGELOG.txt | ||
generate_release_notes: true | ||
|
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