From efa7cfd77e692771787605588df71bbd40feefaa Mon Sep 17 00:00:00 2001 From: coderPaddyS <48881352+coderPaddyS@users.noreply.github.com> Date: Fri, 13 Jan 2023 13:41:25 +0100 Subject: [PATCH] Create new Release workflow. This workflows runs only on prs tagged with 'Release'. It will generate the changelog and commit it to the pr. It will generate the next semver version based on given tags. It will also check if the app version was changed and if the current target sdk is higher than the assigned minimum. --- .github/workflows/app_sdk_check.yml | 44 ++++++++ .github/workflows/app_version_check.yml | 66 ++++++++++++ .github/workflows/changelog.yml | 55 +++++++--- .github/workflows/create_release_pr.yml | 76 +++++++++++++ .github/workflows/latest_version.yml | 29 +++++ .github/workflows/next_version.yml | 42 ++++++++ CHANGELOG.md | 138 +++++++++++++++--------- 7 files changed, 387 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/app_sdk_check.yml create mode 100644 .github/workflows/app_version_check.yml create mode 100644 .github/workflows/create_release_pr.yml create mode 100644 .github/workflows/latest_version.yml create mode 100644 .github/workflows/next_version.yml diff --git a/.github/workflows/app_sdk_check.yml b/.github/workflows/app_sdk_check.yml new file mode 100644 index 00000000..8ef6f83d --- /dev/null +++ b/.github/workflows/app_sdk_check.yml @@ -0,0 +1,44 @@ +name: AppVersionCheck + +on: + workflow_call: + inputs: + app_gradle: + required: false + default: app/build.gradle + type: string + ref: + required: true + type: string + description: "The commit ref to checkout and compare against" + minTargetSdkVersion: + required: true + type: string + secrets: + token: + required: true + +jobs: + sdk_version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.ref }} + - name: "Getting the target sdk version" + id: version + run: | + echo targetSdkVersion=$(cat ${{ inputs.app_gradle }} | grep targetSdkVersion | awk '{print $2}') >> $GITHUB_OUTPUT + outputs: + targetSdkVersion: ${{ steps.version.outputs.targetSdkVersion }} + + check_versions: + runs-on: ubuntu-latest + needs: + - sdk_version + steps: + - name: "Newer target sdk than ${{inputs.minTargetSdkVersion}}" + run: | + if [[ "${{ needs.sdk_version.outputs.targetSdkVersion }}" -lt "${{ inputs.minTargetSdkVersion }}" ]]; then + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/app_version_check.yml b/.github/workflows/app_version_check.yml new file mode 100644 index 00000000..5c536f06 --- /dev/null +++ b/.github/workflows/app_version_check.yml @@ -0,0 +1,66 @@ +name: AppVersionCheck + +on: + workflow_call: + inputs: + app_gradle: + required: false + default: app/build.gradle + type: string + ref: + required: true + type: string + description: "The commit ref to checkout and compare against" + secrets: + token: + required: true + +jobs: + latest_release: + uses: ./.github/workflows/latest_version.yml + secrets: + token: ${{ secrets.token }} + + old_app_version: + runs-on: ubuntu-latest + needs: latest_release + steps: + - uses: actions/checkout@v3 + with: + ref: v${{ needs.latest_release.outputs.latest }} + - name: "Getting the old app version" + id: version + run: | + echo versionCode=$(cat ${{ inputs.app_gradle }} | grep versionCode | awk '{print $2}') >> $GITHUB_OUTPUT + echo versionName=$(cat ${{ inputs.app_gradle }} | grep versionName | awk '{print $2}') >> $GITHUB_OUTPUT + outputs: + versionCode: ${{ steps.version.outputs.versionCode }} + versionName: ${{ steps.version.outputs.versionName }} + + new_app_version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.ref }} + - name: "Getting the new app version" + id: version + run: | + echo versionCode=$(cat ${{ inputs.app_gradle }} | grep versionCode | awk '{print $2}') >> $GITHUB_OUTPUT + echo versionName=$(cat ${{ inputs.app_gradle }} | grep versionName | awk '{print $2}') >> $GITHUB_OUTPUT + outputs: + versionCode: ${{ steps.version.outputs.versionCode }} + versionName: ${{ steps.version.outputs.versionName }} + + check_versions: + runs-on: ubuntu-latest + needs: + - old_app_version + - new_app_version + steps: + - name: "Same VersionCode" + if: ${{ needs.old_app_version.outputs.versionCode }} == ${{ needs.new_app_version.outputs.versionCode }} + run: exit 1 + - name: "Same VersionName" + if: ${{ needs.old_app_version.outputs.versionName }} == ${{ needs.new_app_version.outputs.versionName }} + run: exit 1 \ No newline at end of file diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index ad4099a7..063919c7 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -1,23 +1,54 @@ -name: Changelog Generation +name: Create Changelog on: - release: - types: [published, released] - workflow_dispatch: + workflow_call: + inputs: + ref: + required: true + type: string + version: + required: true + type: string + description: The next version tag + secrets: + token: + required: true + outputs: + changelog: + value: ${{ jobs.changelog.outputs.changelog }} + description: The identifier for the artifact jobs: changelog: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 + name: "Checkout ${{ inputs.ref }}" with: + ref: ${{ inputs.ref }} submodules: 'recursive' - ref: master - - uses: rhysd/changelog-from-release/action@v3 + - name: "Current Date" + id: date + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + - name: "Get PR body" + id: body + run: echo body=$(echo "${{github.event.pull_request.body}}" | sed -e 's/Release-Version:.*//') >> $GITHUB_OUTPUT + - uses: heinrichreimer/action-github-changelog-generator@v2.3 + name: "Generate Changelog" + with: + token: ${{ secrets.token }} + output: "CHANGELOG.md" + - name: "Change Unreleased: to new version ${{ inputs.version }}" + run: | + sed -e 's/\[Unreleased\](https:\/\/github.com\/SecUSo\/privacy-friendly-shopping-list\/tree\/HEAD)/[${{ inputs.version }}](https:\/\/github.com\/SecUSo\/privacy-friendly-shopping-list\/tree\/v${{needs.next_version.outputs.next}}) (${{steps.date.outputs.date}})/' CHANGELOG.md > /tmp/CHANGELOG.md + mv /tmp/CHANGELOG.md CHANGELOG.md + - name: Upload Changelog + uses: actions/upload-artifact@master with: - file: CHANGELOG.md - github_token: ${{ secrets.GITHUB_TOKEN }} - commit_summary_template: 'update changelog for %s changes' - args: -l 2 - header: | - # Changelog + name: Changelog + path: CHANGELOG.md + + outputs: + changelog: Changelog + \ No newline at end of file diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml new file mode 100644 index 00000000..936be9dd --- /dev/null +++ b/.github/workflows/create_release_pr.yml @@ -0,0 +1,76 @@ +name: Changelog Generation + +on: + pull_request: + +jobs: + + next_version: + if: ${{ contains(github.event.pull_request.labels.*.name, 'Release') }} + uses: ./.github/workflows/next_version.yml + secrets: + token: ${{ secrets.GITHUB_TOKEN }} + + app_version_check: + if: ${{ contains(github.event.pull_request.labels.*.name, 'Release') }} + uses: ./.github/workflows/app_version_check.yml + with: + ref: ${{ github.event.pull_request.head.ref }} + secrets: + token: ${{ secrets.GITHUB_TOKEN }} + + sdk_version_check: + if: ${{ contains(github.event.pull_request.labels.*.name, 'Release') }} + uses: ./.github/workflows/app_sdk_check.yml + with: + ref: ${{ github.event.pull_request.head.ref }} + minTargetSdkVersion: ${{ vars.MIN_TARGET_SDK }} + secrets: + token: ${{ secrets.GITHUB_TOKEN }} + + changelog: + if: ${{ contains(github.event.pull_request.labels.*.name, 'Release') }} + uses: ./.github/workflows/changelog.yml + needs: next_version + with: + ref: ${{ github.event.pull_request.head.ref }} + version: v${{ needs.next_version.outputs.next }} + secrets: + token: ${{ secrets.GITHUB_TOKEN }} + + finalize: + if: ${{ contains(github.event.pull_request.labels.*.name, 'Release') }} + runs-on: ubuntu-latest + needs: + - next_version + - app_version_check + - sdk_version_check + - changelog + steps: + - uses: actions/checkout@v3 + name: "Checkout ${{ inputs.ref }}" + with: + ref: ${{ inputs.ref }} + submodules: 'recursive' + - uses: actions/download-artifact@master + with: + name: ${{ needs.changelog.outputs.changelog }} + path: CHANGELOG.md + - name: "Pushing Changelog" + run: | + version=v${{ needs.next_version.outputs.next }} + + git add "CHANGELOG.md" + git config --global user.name "Action-Changelog-Generator" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + if git commit -m "[Action] generated changelog for $version"; then + git tag -d "$version" || true + git tag "$version" + git push + fi + echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + - name: "Append version ${{ needs.next_version.outputs.next }}" + uses: AsasInnab/pr-body-action@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + body: "${{steps.body.outputs.body}}\n\nRelease-Version: ${{ needs.next_version.outputs.next }}. [Changelog](../blob/${{ steps.changelog.outputs.commit }}/CHANGELOG.md)" diff --git a/.github/workflows/latest_version.yml b/.github/workflows/latest_version.yml new file mode 100644 index 00000000..a8e4fcfd --- /dev/null +++ b/.github/workflows/latest_version.yml @@ -0,0 +1,29 @@ +name: Get current version + +on: + workflow_call: + outputs: + latest: + description: "The latest version number in x.y.z notation" + value: ${{ jobs.version.outputs.latest }} + secrets: + token: + required: true + +jobs: + version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: InsonusK/get-latest-release@v1.0.1 + name: "Retreiving the last version number" + id: v + with: + myToken: ${{ secrets.token }} + excludeTypes: "prerelease|draft" + - id: out + run: | + latest=$(echo ${{ steps.v.outputs.tag_name }} | grep -Po '[0-9]+\.[0-9]+\.[0-9]+') + echo "latest=$latest" >> $GITHUB_OUTPUT + outputs: + latest: ${{ steps.out.outputs.latest }} \ No newline at end of file diff --git a/.github/workflows/next_version.yml b/.github/workflows/next_version.yml new file mode 100644 index 00000000..47f91f74 --- /dev/null +++ b/.github/workflows/next_version.yml @@ -0,0 +1,42 @@ +name: Generate next version + +on: + workflow_call: + outputs: + next: + description: "The next version number in x.y.z notation" + value: ${{ jobs.next_version.outputs.next }} + secrets: + token: + required: true + +jobs: + version: + uses: ./.github/workflows/latest_version.yml + secrets: + token: ${{ secrets.token }} + + next_version: + runs-on: ubuntu-latest + needs: version + steps: + - id: next + run: | + latest=${{ needs.version.outputs.latest }} + major=$(echo $latest | awk -F '.' '{print $1}' ) + normal=$(echo $latest | awk -F '.' '{print $2}' ) + minor=$(echo $latest | awk -F '.' '{print $3}' ) + + tags=(${{join(github.event.pull_request.labels.*.name, ' ')}}) + if [[ "${tags[*]}" =~ 'Major' ]]; then + next=$((1 + major)).0.0 + elif [[ "${tags[*]}" =~ 'Minor' ]]; then + next=$major.$normal.$((1 + minor)) + else + next=$major.$((1 + normal)).0 + fi + + echo "next=$next" >> $GITHUB_OUTPUT + + outputs: + next: ${{steps.next.outputs.next}} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d8b5f5d8..667fd491 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,88 +1,124 @@ # Changelog - -## [Shopping List (Privacy Friendly) v1.0.9 (v1.0.9)](https://github.com/SecUSo/privacy-friendly-shopping-list/releases/tag/v1.0.9) - 28 Mar 2019 +## [v1.0.10](https://github.com/SecUSo/privacy-friendly-shopping-list/tree/v1.0.10) (2023-01-14) -- fixed a frequent crash +[Full Changelog](https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.9...HEAD) -[Changes][v1.0.9] +**Implemented enhancements:** +- enhancement: show categories [\#88](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/88) - -## [Privacy Friendly Shopping List v1.0.8 (v1.0.8)](https://github.com/SecUSo/privacy-friendly-shopping-list/releases/tag/v1.0.8) - 29 Jun 2017 +**Closed issues:** -- Bug Fixing -- New Tutorial +- Copyright violation [\#50](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/50) -[Changes][v1.0.8] +**Merged pull requests:** +- Feature/backup integration [\#95](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/95) ([coderPaddyS](https://github.com/coderPaddyS)) +- Repair formatting problems [\#58](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/58) ([katrinleinweber](https://github.com/katrinleinweber)) - -## [Privacy Friendly Shopping List v1.0.7 (v1.0.7)](https://github.com/SecUSo/privacy-friendly-shopping-list/releases/tag/v1.0.7) - 07 Mar 2017 +## [v1.0.9](https://github.com/SecUSo/privacy-friendly-shopping-list/tree/v1.0.9) (2019-03-28) -Versioning problem solved +[Full Changelog](https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.8...v1.0.9) -[Changes][v1.0.7] +**Fixed bugs:** +- rx.exceptions.OnErrorNotImplementedException [\#41](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/41) - -## [Privacy Friendly Shopping List v1.0.6 (v1.0.6)](https://github.com/SecUSo/privacy-friendly-shopping-list/releases/tag/v1.0.6) - 07 Mar 2017 +**Closed issues:** -- Japanese translation -- Reseting of all items added -- Minor bug fixes -- Design Update +- Feature Request: Sortierung "Nach Alphabet \(A bis Z\)" [\#63](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/63) +- Feature Request: erledigte Aufgaben am Seitenende \(Ansicht "Alle Aufgaben"\) [\#62](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/62) +- Feature Request: Einstellung bzgl. Aufgaben-Ansicht dauerhaft gespeichert [\#61](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/61) +- New Product dialog: Category textbox inaccessible if cursor is in Notes [\#57](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/57) +**Merged pull requests:** -[Changes][v1.0.6] +- Fix typo [\#60](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/60) ([8sd](https://github.com/8sd)) +## [v1.0.8](https://github.com/SecUSo/privacy-friendly-shopping-list/tree/v1.0.8) (2017-06-29) - -## [Privacy Friendly Shopping List v1.0.5 (v1.0.5)](https://github.com/SecUSo/privacy-friendly-shopping-list/releases/tag/v1.0.5) - 21 Nov 2016 +[Full Changelog](https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.7...v1.0.8) -New features: -- Duplication of list items -- Sharing of list items +**Fixed bugs:** -Bug fixes: -- Adjustment of font size according to the device +- Present quantity field to 1 [\#33](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/33) +**Closed issues:** -[Changes][v1.0.5] +- + Button gets inaccessible [\#37](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/37) +- "+" button disappears and doesn't come back when scrolling long lists [\#36](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/36) +**Merged pull requests:** - -## [Privacy Friendly Shopping List v1.0.4 (v1.0.4)](https://github.com/SecUSo/privacy-friendly-shopping-list/releases/tag/v1.0.4) - 19 Nov 2016 +- Use ScrollListener for current support library [\#39](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/39) ([rleonhardt](https://github.com/rleonhardt)) +- Bug Fixes, Refactoring and New Feature [\#35](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/35) ([ifillbrito](https://github.com/ifillbrito)) -New feature: duplication of lists +## [v1.0.7](https://github.com/SecUSo/privacy-friendly-shopping-list/tree/v1.0.7) (2017-03-07) +[Full Changelog](https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.6...v1.0.7) -[Changes][v1.0.4] +## [v1.0.6](https://github.com/SecUSo/privacy-friendly-shopping-list/tree/v1.0.6) (2017-03-07) +[Full Changelog](https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.5...v1.0.6) - -## [Privacy Friendly Shopping List v1.0.3 (v1.0.3)](https://github.com/SecUSo/privacy-friendly-shopping-list/releases/tag/v1.0.3) - 06 Nov 2016 +**Implemented enhancements:** -Create shopping lists and managing them (adding, editing and deleting of lists and items). -Further features include: -– Prioritization of list -– Setup of deadlines and reminders. The reminder will appear as a notification. -– Visualizing of shopping activities through a bar diagram -– Adding of categories, stores and additional notes to products. Possibility to add a product picture. This photo can only be accessed by Privacy Friendly Shopping List. -– Sharing of lists and/or products as text without the requirement of special system permissions. +- Update Welcome-Dialog [\#24](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/24) +- comma in fractional numbers [\#21](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/21) +- Feature Request: reset list [\#16](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/16) -This app is optimized regarding the user’s privacy. It doesn’t use any tracking mechanisms, neither it displays any advertisement. It belongs to the Privacy Friendly Apps group developed by the Technische Universität Darmstadt. +**Closed issues:** +- typo \(german version\) [\#30](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/30) +- Use intent instead of camera [\#19](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/19) -[Changes][v1.0.3] +**Merged pull requests:** +- Fixes \#30 Typo: Standardeinstellung [\#31](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/31) ([ifillbrito](https://github.com/ifillbrito)) +- Update welcome dialog [\#29](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/29) ([ifillbrito](https://github.com/ifillbrito)) +- luiscruz contribution: refactor obsoleteLayoutParam [\#28](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/28) ([ifillbrito](https://github.com/ifillbrito)) +- Point/Comma bug fix [\#26](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/26) ([ifillbrito](https://github.com/ifillbrito)) +- japanese translation [\#23](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/23) ([naofum](https://github.com/naofum)) +- Reset list [\#17](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/17) ([ifillbrito](https://github.com/ifillbrito)) -[v1.0.9]: https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.8...v1.0.9 -[v1.0.8]: https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.7...v1.0.8 -[v1.0.7]: https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.6...v1.0.7 -[v1.0.6]: https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.5...v1.0.6 -[v1.0.5]: https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.4...v1.0.5 -[v1.0.4]: https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.3...v1.0.4 -[v1.0.3]: https://github.com/SecUSo/privacy-friendly-shopping-list/tree/v1.0.3 +## [v1.0.5](https://github.com/SecUSo/privacy-friendly-shopping-list/tree/v1.0.5) (2016-11-21) - +[Full Changelog](https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.4...v1.0.5) + +**Implemented enhancements:** + +- \[Feature Request\] Sort of place of purchase [\#10](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/10) +- autorotation, font-size [\#5](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/5) + +**Merged pull requests:** + +- Font size according to device settings [\#12](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/12) ([ifillbrito](https://github.com/ifillbrito)) +- Edit, Delete, Share dialog for products updated [\#11](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/11) ([ifillbrito](https://github.com/ifillbrito)) + +## [v1.0.4](https://github.com/SecUSo/privacy-friendly-shopping-list/tree/v1.0.4) (2016-11-19) + +[Full Changelog](https://github.com/SecUSo/privacy-friendly-shopping-list/compare/v1.0.3...v1.0.4) + +**Closed issues:** + +- Create a new list from the old list [\#7](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/7) +- Missing root project: Move build.gradle.copy to build.gradle [\#4](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/4) +- Mismatching version information [\#3](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/3) + +**Merged pull requests:** + +- closes \#7. Duplicate lists, Screen rotation, ScrollViews, Async Refactoring [\#9](https://github.com/SecUSo/privacy-friendly-shopping-list/pull/9) ([ifillbrito](https://github.com/ifillbrito)) + +## [v1.0.3](https://github.com/SecUSo/privacy-friendly-shopping-list/tree/v1.0.3) (2016-11-05) + +[Full Changelog](https://github.com/SecUSo/privacy-friendly-shopping-list/compare/9f73390a63c9690cff1c90ac416e7adb1a631bfc...v1.0.3) + +**Closed issues:** + +- README.md and License [\#2](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/2) +- Please remove Funktionsumfangsdokument from Repo [\#1](https://github.com/SecUSo/privacy-friendly-shopping-list/issues/1) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*