Skip to content
Open
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
76 changes: 76 additions & 0 deletions .github/workflows/dynamic-vars-tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Dynamic Vars Tasks

on:
workflow_dispatch:
inputs:
SNAPSHOT_BUILD_VERSION:
description: 'Snapshot build version'
required: true

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: '11'

- name: Create branch
run: |
git checkout -b dynamic-vars-tasks

- name: Update pom.xml with snapshot build version
run: |
sed -i "s/<version>.*<\/version>/<version>${SNAPSHOT_BUILD_VERSION}<\/version>/" pom.xml

- name: Build
run: |
mvn clean package -Dmaven.test.skip=true

- name: Commit changes
run: |
git add .
git commit -m "Update pom.xml with snapshot build version ${SNAPSHOT_BUILD_VERSION}"

- name: Push changes to branch
uses: ad-m/github-push-action@v0.5.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true

- name: Create PR
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Update pom.xml with snapshot build version ${SNAPSHOT_BUILD_VERSION}',
head: 'dynamic-vars-tasks',
base: 'main',
body: 'Automatically generated PR'
})

- name: CodeQL scanning
uses: github/codeql-action/analyze@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
languages: java

- name: Merge PR
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: github.context.pullRequest.number,
commit_title: 'Merge PR',
commit_message: 'Automatically merged PR'
})