diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index c0234042a..80ccb9c4b 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -1,10 +1,24 @@ name: auto-approve -on: pull_request_target + +on: + pull_request_target: + types: + - opened + - synchronize + workflow_dispatch: + inputs: + pullRequestNumber: + description: Pull request number to auto-approve + required: false jobs: auto-approve: runs-on: ubuntu-latest permissions: pull-requests: write + if: github.actor == 'dependabot[bot]' || github.ref == 'refs/heads/platform/update-version-meta-data' || github.event_name == 'workflow_dispatch' steps: - uses: hmarr/auto-approve-action@v3 + with: + review-message: "Auto approved automated PR" + pull-request-number: ${{ github.event.inputs.pullRequestNumber }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index d955fde8d..d736f38db 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -3,26 +3,75 @@ name: release-drafter on: push: branches: - - develop + - 'develop' pull_request: # Only following types are handled by the action, but one can default to all as well - types: [opened, reopened, synchronize] + types: [ opened, reopened, synchronize ] permissions: contents: read jobs: - update-release-draft: + update-draft-release: permissions: - # write permission is required to create a github release contents: write - # write permission is required for autolabeler pull-requests: write runs-on: ubuntu-latest steps: - - uses: release-drafter/release-drafter@v5 + - uses: release-drafter/release-drafter@v6 + id: release_drafter with: - config-name: release-drafter-config.yml - disable-autolabeler: false + config-name: release-drafter-config.yml + disable-autolabeler: false + commitish: develop env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: 'develop' + - name: set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + - name: Configure dummy files + run: | + mv app/.travic-ci/google-services.json app/google-services.json + mv app/.travic-ci/secrets app/.config/secrets.properties + + - name: Extract version + id: version + run: echo "${{ steps.release_drafter.outputs.resolved_version }}" > VERSION + + - name: Calculate code + id: code + run: | + IFS='.' read -ra VER <<< "$(cat VERSION)" + MAJOR=$((VER[0] * 1000000000)) + MINOR=$((VER[1] * 1000000)) + PATCH=$((VER[2] * 1000)) + CODE=$((MAJOR + MINOR + PATCH)) + echo "version=$(cat VERSION)" > gradle/version.properties + echo "code=$CODE" >> gradle/version.properties + echo "name=v$(cat VERSION)" >> gradle/version.properties + + - name: Show version + run: cat gradle/version.properties + + - name: Generate version.json + run: ./gradlew generateVersions + + - name: Push auto generated version file + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "automation: update version.properties" + branch: platform/update-version-meta-data + commit_options: '--no-verify --signoff' + file_pattern: 'gradle/version.properties app/.meta/version.json' + repository: . + commit_author: Author + create_branch: true + push_options: '--force' + skip_fetch: true \ No newline at end of file diff --git a/.github/workflows/version-updater.yml b/.github/workflows/version-updater.yml index 4b16ef1f7..232c025ed 100644 --- a/.github/workflows/version-updater.yml +++ b/.github/workflows/version-updater.yml @@ -1,44 +1,45 @@ name: version-updater + on: - repository_dispatch: - types: [version-updater] + push: + branches: + - 'platform/update-version-meta-data' + + workflow_dispatch: + inputs: + branchName: + description: Pull request against branch + default: 'platform/update-version-meta-data' + type: choice + options: + - 'platform/update-version-meta-data' + required: true + + +permissions: + contents: write + pull-requests: write jobs: version-updater: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 - - - name: Extract version - id: version - run: echo "${GITHUB_REF#refs/tags/}" > VERSION - - - name: Calculate version code - id: code - run: | - IFS='.' read -ra VER <<< "$(cat VERSION)" - MAJOR=$((VER[0] * 1000000000)) - MINOR=$((VER[1] * 10000)) - PATCH=${VER[2]} - CODE=$((MAJOR + MINOR + PATCH)) - echo "version=$(cat VERSION)" > gradle/version.properties - echo "code=$CODE" >> gradle/version.properties - echo "name=v$(cat VERSION)" >> gradle/version.properties - - - name: Show release info - run: cat gradle/version.properties + uses: actions/checkout@v4 + with: + ref: develop - - name: Commit version.properties - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add gradle/version.properties - git commit -m "Bump version to $(cat VERSION)" - - - name: Push changes - uses: ad-m/github-push-action@master + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: develop - directory: . + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "automation: update version.properties" + author: "Author " + title: "platform: automated version update" + body: | + This PR was automatically generated to update version.properties. + branch: ${{ github.event.inputs.branchName }} + base: develop + labels: "skip-changelog" + assignees: "wax911" + reviewers: "wax911"