-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: Auto PR akka-samples #271
base: main
Are you sure you want to change the base?
Changes from all commits
df40a57
3cf1731
4e5b7da
42c136b
2fe1bdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: Update and PR akka-samples | ||
|
||
on: | ||
workflow_dispatch: # to trigger manually | ||
workflow_run: | ||
workflows: ["Publish"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
debug: | ||
if: github.event_name != 'workflow_dispatch' | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Debugging | ||
run: | | ||
echo "Conclusion from `Publish` workflow: ${{ github.event.workflow_run.conclusion }} | ||
echo "Tag created from `Publish` workflow: ${{ github.ref }} | ||
|
||
update-samples: | ||
runs-on: ubuntu-22.04 | ||
# run only when `publish` workflow is successful or this workflow manually triggered | ||
if: (github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch') | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- { sample: "shopping-cart-quickstart", sampleRepo: "akka-samples/shopping-cart-quickstart" } | ||
|
||
steps: | ||
- name: Checkout | ||
# https://github.com/actions/checkout/releases | ||
# v4.1.1 | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
with: | ||
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves | ||
fetch-depth: 0 | ||
|
||
- name: Cache Coursier cache | ||
# https://github.com/coursier/cache-action/releases | ||
# v6.4.5 | ||
uses: coursier/cache-action@1ff273bff02a8787bc9f1877d347948af647956d | ||
|
||
- name: Set up JDK 21 | ||
# https://github.com/coursier/setup-action/releases | ||
# v1.3.5 | ||
uses: coursier/setup-action@7bde40eee928896f074dbb76d22dd772eed5c65f | ||
with: | ||
jvm: temurin:1.21 | ||
|
||
- name: Determine SDK version | ||
id: determine_sdk_version | ||
run: |- | ||
.github/determine-sdk-version.sh | ||
SDK_VERSION="$(cat ~/akka-javasdk-version.txt)" | ||
echo "SDK version: '${SDK_VERSION}'" | ||
echo "sdk_version=${SDK_VERSION}" >> $GITHUB_OUTPUT | ||
|
||
- name: Determine SDK version (manual triggered) # provisional until normal flow gets fixed) | ||
if: github.event_name == 'workflow_dispatch' | ||
id: determine_sdk_version_manual_triggered | ||
run: |- | ||
.github/determine-sdk-version.sh | ||
SDK_VERSION="$(cat ~/akka-javasdk-version.txt | sed 's/-.*//')" | ||
echo "SDK version: '${SDK_VERSION}'" | ||
echo "sdk_version=${SDK_VERSION}" >> $GITHUB_OUTPUT | ||
|
||
- name: Update SDK versions and bundle | ||
env: | ||
SDK_VERSION: ${{ steps.determine_sdk_version.outputs.sdk_version || steps.determine_sdk_version_manual_triggered.outputs.sdk_version }} | ||
run: |- | ||
echo "Updating samples to version ${SDK_VERSION}" | ||
./updateSdkVersions.sh all | ||
./docs/bin/bundle.sh --zip "target/bundle/${{ matrix.sample }}.zip" samples/${{ matrix.sample }} | ||
|
||
- name: Checkout | ||
# https://github.com/actions/checkout/releases/tag/v4.2.2 | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
with: | ||
repository: ${{ matrix.sampleRepo }} | ||
path: akka-samples-${{ matrix.sample }} | ||
token: ${{ secrets.AKKA_SDK_RW_ACCESS_TOKEN }} | ||
ref: main | ||
|
||
- name: Open PR with changes | ||
env: | ||
COMMIT_URL: "https://github.com/${{ github.repository }}/commit/" | ||
GH_TOKEN: ${{ secrets.AKKA_SAMPLES_RW_ACCESS_TOKEN }} | ||
run: | | ||
cd akka-samples-${{ matrix.sample }} | ||
git config user.name "github-actions[bot]" | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure if this is the one we want to use? it was already used in this repo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was also surprised by this in a PR review, for the record It's a global github actions bot user id (https://api.github.com/users/github-actions%5Bbot%5D) |
||
git remote add origin-rw https://${{ secrets.AKKA_SAMPLES_RW_ACCESS_TOKEN }}@github.com/${{ matrix.sampleRepo }}.git | ||
BRANCH=update-sdk-${SDK_VERSION} | ||
git checkout -b $BRANCH | ||
rsync -a ../docs/build/bundle${{ matrix.sample }}/ ./ | ||
git add . | ||
git commit . -m "chore: bump SDK version to ${SDK_VERSION}" | ||
git push --set-upstream origin-rw $BRANCH | ||
gh pr create -B main -t "Auto PR - Bump SDK version to ${SDK_VERSION}" \ | ||
-b "This PR should update SDK (pom.xml) and latest source code. [$GITHUB_SHA]($COMMIT_URL$GITHUB_SHA)" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,10 @@ | |
.settings/ | ||
|
||
# Intellij | ||
.idea/ | ||
.idea | ||
!.idea/ | ||
.idea/* | ||
!.idea/runConfigurations/Run_locally.xml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks crazy, but seems to work. found it here https://github.com/daggerok/gitignore-idea-runConfigurations |
||
*.iml | ||
*.iws | ||
|
||
|
@@ -20,4 +23,4 @@ target/ | |
effective-pom.xml | ||
|
||
#local db | ||
db.mv.db | ||
db.mv.db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to create this