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

PWN-6722 - Changelog fixes & Kotlin DSL migration #1257

Merged
merged 43 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e2878ba
PWN-6722 - Changelog fixes
1sakov Feb 15, 2023
960b5af
PWN-6722 - Changelog fixes 2
1sakov Feb 15, 2023
ff47a2f
PWN-6722 - Changelog fixes 3
1sakov Feb 15, 2023
dd3fe76
PWN-6722 - Changelog fixes 4
1sakov Feb 15, 2023
6ee21e9
PWN-6722 - commenting assemble step, checking logs
1sakov Feb 15, 2023
f8ebe02
PWN-6722 - commenting assemble step, checking logs 2
1sakov Feb 15, 2023
509fcbc
PWN-6722 - Migrated to Kotlin DSL, updated changelog
1sakov Feb 15, 2023
a3e72ae
PWN-6722 - Moved generate changelog to script
1sakov Feb 15, 2023
4e5e7f0
PWN-6722 - Permission for script
1sakov Feb 15, 2023
9c37a67
PWN-6722 - Permission for script 2
1sakov Feb 15, 2023
a094e0a
PWN-6722 - Changelog fixes
1sakov Feb 15, 2023
59cae4d
PWN-6722 - Changelog fixes 2
1sakov Feb 15, 2023
927e828
PWN-6722 - Changelog fixes 3
1sakov Feb 16, 2023
eabf751
PWN-6722 - Changelog fixes 4
1sakov Feb 16, 2023
e1b95c4
PWN-6722 - Changelog fixes 5
1sakov Feb 16, 2023
d1390f3
PWN-6722 - Changelog fixes 6
1sakov Feb 16, 2023
b5ad079
PWN-6722 - Changelog fixes 7
1sakov Feb 16, 2023
44afa70
PWN-6722 - Changelog fixes 8
1sakov Feb 16, 2023
7635cf2
PWN-6722 - Changelog fixes 9
1sakov Feb 16, 2023
d99437a
PWN-6722 - Changelog fixes 10
1sakov Feb 16, 2023
9abfc7a
PWN-6722 - Changelog fixes 11
1sakov Feb 16, 2023
b1eee9f
PWN-6722 - Changelog fixes 12
1sakov Feb 16, 2023
25d3700
PWN-6722 - Changelog fixes 13
1sakov Feb 16, 2023
4ff7dda
PWN-6722 - Changelog fixes 14
1sakov Feb 16, 2023
fcc97fa
PWN-6722 - Changelog fixes 15
1sakov Feb 16, 2023
e782015
PWN-6722 - Changelog fixes 16
1sakov Feb 16, 2023
47579b6
PWN-6722 - Changelog fixes 17
1sakov Feb 16, 2023
a1893c1
PWN-6722 - Changelog fixes 18
1sakov Feb 16, 2023
f7cb28a
PWN-6722 - Changelog fixes 19
1sakov Feb 16, 2023
eb59123
PWN-6722 - Try fix changelog
1sakov Feb 20, 2023
974f5a8
PWN-6722 - Try fix changelog 2
1sakov Feb 20, 2023
17f1b86
PWN-6722 - Try fix changelog 3
1sakov Feb 20, 2023
e62685d
PWN-6722 - Try fix changelog 4
1sakov Feb 20, 2023
380a381
PWN-6722 - Try fix changelog 5
1sakov Feb 20, 2023
59c883b
PWN-6722 - Try fix changelog 6
1sakov Feb 20, 2023
62e274c
PWN-6722 - Try fix changelog 7
1sakov Feb 20, 2023
f3aeb6f
PWN-6722 - Try fix changelog 8
1sakov Feb 20, 2023
5834339
PWN-6722 - Try fix changelog 9
1sakov Feb 20, 2023
a7bc128
PWN-6722 - Try fix changelog 10
1sakov Feb 20, 2023
9ab65ef
PWN-6722 - Try fix changelog 11
1sakov Feb 20, 2023
1d59a7b
PWN-6722 - Try fix changelog 12
1sakov Feb 20, 2023
256c2d7
PWN-6722 - Try fix changelog 13
1sakov Feb 20, 2023
5e66c29
PWN-6722 - Fixed changelog, cleaning
1sakov Feb 20, 2023
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
26 changes: 26 additions & 0 deletions .github/actions/setup-changelog/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Generate changelog"
description: "Getting commits from last commit hash to current one"

runs:
using: composite
steps:
- name: "Find last commit hash and current one"
shell: bash
run: |
# Get the latest commit hash was saved in last_commit_hash.txt
last_commit_hash=$(cat last_commit_hash.txt)

# Fetch the latest changes from the remote repository
git fetch origin

# Determine the current head commit hash
if [ -n "$GITHUB_HEAD_REF" ]; then
# This is a pull request, use GITHUB_HEAD_REF
current_commit_hash="$(git log -n 1 --pretty=%H origin/$GITHUB_HEAD_REF)"
else
# This is not a pull request, use GITHUB_BASE_REF
current_commit_hash="$(git log -n 1 --pretty=%H origin/$GITHUB_BASE_REF)"
fi

# Run the gradle task with the fromCommit and toCommit properties set
./gradlew gitChangelogTask -PfromCommit=$last_commit_hash -PtoCommit=$current_commit_hash
4 changes: 2 additions & 2 deletions .github/actions/setup-jira-rft/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ runs:
echo "JIRA Ticket: $jira_ticket"
env:
jira-ticket: ${{ steps.find-jira-ticket.outputs.jira_ticket }}
- name: Update JIRA issue status
- name: "Update JIRA issue status"
shell: bash
if: env.jira-ticket
if: steps.find-jira-ticket.outputs.jira_ticket != ''
run: |
curl -D- -H "Authorization: Basic ${{ inputs.jira-api-token }}" \
-X PUT \
Expand Down
1 change: 0 additions & 1 deletion .github/actions/setup-slack/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ runs:
curl \
-F token="${{ inputs.bot-token }}" \
-F channels="${{ inputs.channel-id }}" \
-F initial_comment="Hey! Build type: ${{ inputs.build-type }} artifact type: ${{ inputs.artifact-type }}. Success :tada:" \
-F "file=@$(find app/build/outputs/${{ inputs.artifact-type }}/${{ inputs.build-type }} -name 'key-app*')" \
https://slack.com/api/files.upload
2 changes: 1 addition & 1 deletion .github/actions/setup-version-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ runs:
run_number=${{ github.run_number }}

# Combine the timestamp with the GITHUB_RUN_NUMBER
version=$((timestamp / run_number))
version=$((timestamp + run_number))

# Set the version build number using the unique identifier
./gradlew setVersionBuild -Pversion=$version
Expand Down
37 changes: 24 additions & 13 deletions .github/workflows/android-develop-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: develop
- name: "Initialize project keys"
uses: ./.github/actions/setup-project
with:
Expand Down Expand Up @@ -41,6 +43,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: develop
- name: "Initializing firebase configs"
uses: ./.github/actions/setup-google-services
with:
Expand Down Expand Up @@ -76,6 +80,7 @@ jobs:
- name: "Checkout to the current commit hash"
uses: actions/checkout@v3
with:
ref: develop
fetch-depth: 0
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: "Initializing firebase configs"
Expand All @@ -101,11 +106,10 @@ jobs:
sentry-auth-dsn: ${{ secrets.SENTRY_AUTH_DSN }}
lokalise-key: ${{ secrets.LOKALISE_KEY }}
lokalise-app-id: ${{ secrets.LOKALISE_APP_ID }}
- name: "Generate changelog"
uses: ./.github/actions/setup-changelog
- name: "Send start deploy message to slack"
run: |
cd bash_scripts
bash slack_deploy_start_message.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }}
cd ..
run: bash bash_scripts/slack_deploy_start_message.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }}
- name: "Generate a unique version build"
uses: ./.github/actions/setup-version-build
- name: "Build feature APK"
Expand All @@ -123,17 +127,11 @@ jobs:
build-type: "feature"
artifact-type: "apk"
- name: "Upload changelog, and Jira ticket to slack channel"
run: |
cd bash_scripts
value=`cat timestamp.txt`
bash slack_develop_changelog.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }}
cd ..

run: bash bash_scripts/slack_upload_changelog.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }} CHANGELOG.txt
- name: "Send finish deploy message to slack"
run: |
cd bash_scripts
value=`cat timestamp.txt`
bash slack_deploy_finish_message.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }} $value
bash bash_scripts/slack_deploy_finish_message.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }} $value
- name: "Commit and Push changes"
uses: ./.github/actions/setup-commit
with:
Expand All @@ -145,8 +143,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: develop
- name: "Find a Jira ticket and move it to READY FOR TESTING"
uses: ./.github/actions/setup-jira-rft
with:
jira-base-url: ${{ vars.JIRA_BASE_URL }}
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
save-last-commit-hash:
name: "Save last commit hash for future changelogs"
needs:
- android-build-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: develop
- name: "Get last commit hash and save into last_commit_hash.txt"
run: printf "$(git log -n 1 --pretty=%H)" > last_commit_hash.txt
19 changes: 7 additions & 12 deletions .github/workflows/android-feature-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
run: ./gradlew ktlint -PautoCorrect=0
android-build-artifacts:
name: "Run build feature artifacts"
needs:
- android-lint
# needs:
# - android-lint

runs-on: ubuntu-latest
environment: manual
Expand Down Expand Up @@ -65,11 +65,11 @@ jobs:
sentry-auth-dsn: ${{ secrets.SENTRY_AUTH_DSN }}
lokalise-key: ${{ secrets.LOKALISE_KEY }}
lokalise-app-id: ${{ secrets.LOKALISE_APP_ID }}
- name: "Generate changelog"
uses: ./.github/actions/setup-changelog
- name: "Send start deploy message to slack"
run: |
cd bash_scripts
bash slack_deploy_start_message.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }}
cd ..
bash bash_scripts/slack_deploy_start_message.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }}
- name: "Build feature APK"
run: ./gradlew assembleFeature
- name: "Build & upload APK to Firebase (Feature)"
Expand All @@ -86,13 +86,8 @@ jobs:
artifact-type: "apk"
- name: "Upload changelog, and Jira ticket to slack channel"
run: |
cd bash_scripts
value=`cat timestamp.txt`
bash slack_shortlog_changelog.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }} "develop"
cd ..

bash bash_scripts/slack_upload_changelog.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }} CHANGELOG.txt
- name: "Send finish deploy message to slack"
run: |
cd bash_scripts
value=`cat timestamp.txt`
bash slack_deploy_finish_message.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }} $value
bash bash_scripts/slack_deploy_finish_message.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }} $value
20 changes: 1 addition & 19 deletions .github/workflows/android-release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ jobs:
steps:
- name: "Checkout to the current commit hash"
uses: actions/checkout@v3
- name: "Send start deploy message to slack"
run: |
cd bash_scripts
bash slack_deploy_start_message.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }}
cd ..

- name: "Create release signing configs properties"
uses: ./.github/actions/setup-signing-configs
with:
Expand Down Expand Up @@ -61,16 +55,4 @@ jobs:
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
build-type: "release"
artifact-type: "bundle"
- name: "Upload git changelog and Jira ticket to Slack channel"
run: |
cd bash_scripts
value=`cat timestamp.txt`
bash slack_shortlog_changelog.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }} "main"
cd ..

- name: "Send finish deploy message to Slack"
run: |
cd bash_scripts
value=`cat timestamp.txt`
bash slack_deploy_finish_message.sh ${{ secrets.SLACK_BOT_TOKEN }} ${{ secrets.SLACK_CHANNEL_ID }} $value
artifact-type: "bundle"
File renamed without changes.
14 changes: 14 additions & 0 deletions scripts/changelog.gradle → .scripts/changelog.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,18 @@ ext.releaseChangelog = { releaseName, buildType ->
.append("Release notes:\n")
.append("${branchChangelog()}")
.toString()
}

task gitChangelogTask(type: Exec) {
def from = findProperty('fromCommit')
def to = findProperty('toCommit')

executable "sh"
args "-c", "git log $from..$to --no-merges --pretty=format:\"%h - %s - %an\" > CHANGELOG.txt"

doFirst {
if (from == null || to == null) {
throw new GradleException("fromCommit or toCommit is not defined. Did you set properties? (-PfromCommit=somecommithash -PtoCommit=somecommithash)")
}
}
}
File renamed without changes.
10 changes: 10 additions & 0 deletions .scripts/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ext {
sdkMinVersion = 26
sdkTargetVersion = 33
sdkCompileVersion = 33

// https://github.com/shyiko/ktlint
ktlintVersion = '0.45.2'

kotlinVersion = '1.7.20'
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions .scripts/versioning.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// example './gradlew setVersionBuild -Pversion=10'
tasks.register("setVersionBuild", Exec::class) {
doLast {
val version = project.findProperty("version") as Long?

if (version == null) {
logger.error("Invalid version argument, usage: ./gradlew setVersionBuild -Pversion=10")
return@doLast
}

val appVersionsClass = File("${rootProject.projectDir}/buildSrc/src/main/java/AppVersions.kt")
if (!appVersionsClass.exists()) {
logger.error("AppVersions.kt not found in buildSrc/src/main/java/")
return@doLast
}

appVersionsClass.forEachLine { line ->
if (line.contains("const val VERSION_BUILD")) {
val newLine = " const val VERSION_BUILD = $version\n"
appVersionsClass.writeText(appVersionsClass.readText().replace(line, newLine))
logger.quiet("VERSION_BUILD updated to $version")
}
}
}
}
3 changes: 0 additions & 3 deletions CHANGELOG.md

This file was deleted.

Loading