Skip to content
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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .github/workflows/pr-akka-samples.yml
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 }}
Copy link
Member Author

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

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"
Copy link
Member Author

Choose a reason for hiding this comment

The 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

Copy link
Member

Choose a reason for hiding this comment

The 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
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
5 changes: 4 additions & 1 deletion docs/release-issue-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ You can see the Akka Runtime version on prod [on grafana](https://grafana.sre.ka
### Publish latest docs
- [ ] Add a summary of relevant changes into `docs/src/modules/reference/pages/release-notes.adoc`
- [ ] Create a PR and merge `main` into `docs-current` (do not squash)
- Note that the PR will be pretty big normally, not only involving documentation files.
- Note that the PR will be pretty big normally, not only involving documentation files.

### Update samples
- [ ] Merge auto-PR in https://github.com/akka-samples/shopping-cart-quickstart/pulls?q=is%3Apr+is%3Aopen+auto+pr+

### Announcements

Expand Down
5 changes: 4 additions & 1 deletion samples/choreography-saga-quickstart/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand Down
5 changes: 4 additions & 1 deletion samples/doc-snippets/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand Down
7 changes: 5 additions & 2 deletions samples/event-sourced-counter-brokers/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
Copy link
Member Author

Choose a reason for hiding this comment

The 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

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
7 changes: 5 additions & 2 deletions samples/event-sourced-customer-registry-subscriber/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
7 changes: 5 additions & 2 deletions samples/event-sourced-customer-registry/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
7 changes: 5 additions & 2 deletions samples/key-value-counter/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
7 changes: 5 additions & 2 deletions samples/key-value-customer-registry/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
7 changes: 5 additions & 2 deletions samples/key-value-shopping-cart/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
7 changes: 5 additions & 2 deletions samples/reliable-timers/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
7 changes: 5 additions & 2 deletions samples/shopping-cart-quickstart/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
7 changes: 5 additions & 2 deletions samples/spring-dependency-injection/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
7 changes: 5 additions & 2 deletions samples/tracing/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
7 changes: 5 additions & 2 deletions samples/transfer-workflow-compensation/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
7 changes: 5 additions & 2 deletions samples/transfer-workflow/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
.settings/

# Intellij
.idea/
.idea
!.idea/
.idea/*
!.idea/runConfigurations/Run_locally.xml
*.iml
*.iws

Expand All @@ -20,4 +23,4 @@ target/
effective-pom.xml

#local db
db.mv.db
db.mv.db
Loading