From 05084eb806892c71adb8e515fd28e909812cb26e Mon Sep 17 00:00:00 2001 From: Viacheslav Kudinov Date: Fri, 11 Jun 2021 15:15:04 +0200 Subject: [PATCH 1/5] Workflow for PR. --- .github/workflows/build-action.yaml | 32 +++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-action.yaml b/.github/workflows/build-action.yaml index 9b92931..9fa6fcb 100644 --- a/.github/workflows/build-action.yaml +++ b/.github/workflows/build-action.yaml @@ -3,10 +3,9 @@ name: "Build and test Maven GitHub action" on: pull_request: branches: [ master ] - push: jobs: - build: + build_and_test: name: "Set up Maven and validate" runs-on: ubuntu-latest strategy: @@ -47,3 +46,32 @@ jobs: - name: "Validate Maven version" run: mvn -v | head -1 | grep "${{ matrix.maven_version }}" + + build_and_commit: + name: "Set up Maven and validate" + runs-on: ubuntu-latest + + steps: + - name: "Checkout code" + uses: actions/checkout@v2 + + - name: "Set Node.js" + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: "Install" + run: npm install + + - name: "Commit files" + run: | + git config --local user.email "$(git log --format='%ae' HEAD^!)" + git config --local user.name "$(git log --format='%an' HEAD^!)" + git remote add github "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" + git pull github ${GITHUB_REF} --ff-only + git add . + if [ -z "$(git status --porcelain)" ]; then + exit 0 + fi + git commit -m "Fix a[href] in Webflow exported html" + git push github HEAD:${GITHUB_REF} From 4d9429e4e7bb8d81aa047614597cea066a17c663 Mon Sep 17 00:00:00 2001 From: Viacheslav Kudinov Date: Fri, 11 Jun 2021 15:19:37 +0200 Subject: [PATCH 2/5] Source branch fix. --- .github/workflows/build-action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-action.yaml b/.github/workflows/build-action.yaml index 9fa6fcb..d505628 100644 --- a/.github/workflows/build-action.yaml +++ b/.github/workflows/build-action.yaml @@ -74,4 +74,4 @@ jobs: exit 0 fi git commit -m "Fix a[href] in Webflow exported html" - git push github HEAD:${GITHUB_REF} + git push github HEAD:${{ github.head_ref }} From c3e692e86f49f823bdb25956bc269fdafeea636c Mon Sep 17 00:00:00 2001 From: Viacheslav Kudinov Date: Fri, 11 Jun 2021 15:21:10 +0200 Subject: [PATCH 3/5] Source branch fix. --- .github/workflows/build-action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-action.yaml b/.github/workflows/build-action.yaml index d505628..37802fb 100644 --- a/.github/workflows/build-action.yaml +++ b/.github/workflows/build-action.yaml @@ -68,7 +68,7 @@ jobs: git config --local user.email "$(git log --format='%ae' HEAD^!)" git config --local user.name "$(git log --format='%an' HEAD^!)" git remote add github "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" - git pull github ${GITHUB_REF} --ff-only + git pull github {{ github.head_ref }} --ff-only git add . if [ -z "$(git status --porcelain)" ]; then exit 0 From e6f08bedca1d202ea7beb23222ad48d7b6b55c4b Mon Sep 17 00:00:00 2001 From: Viacheslav Kudinov Date: Fri, 11 Jun 2021 15:21:56 +0200 Subject: [PATCH 4/5] Source branch fix. --- .github/workflows/build-action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-action.yaml b/.github/workflows/build-action.yaml index 37802fb..28fd27b 100644 --- a/.github/workflows/build-action.yaml +++ b/.github/workflows/build-action.yaml @@ -68,7 +68,7 @@ jobs: git config --local user.email "$(git log --format='%ae' HEAD^!)" git config --local user.name "$(git log --format='%an' HEAD^!)" git remote add github "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" - git pull github {{ github.head_ref }} --ff-only + git pull github ${{ github.head_ref }} --ff-only git add . if [ -z "$(git status --porcelain)" ]; then exit 0 From f87174c9fc5130e273ad14138ce0e3520d678f56 Mon Sep 17 00:00:00 2001 From: Viacheslav Kudinov Date: Fri, 11 Jun 2021 15:38:23 +0200 Subject: [PATCH 5/5] Push none master branch actions. --- ...{build-action.yaml => pr_into_master.yaml} | 31 +----------- .github/workflows/push_into_none_master.yaml | 49 +++++++++++++++++++ ...maven_actions.yaml => push_to_master.yaml} | 2 +- 3 files changed, 51 insertions(+), 31 deletions(-) rename .github/workflows/{build-action.yaml => pr_into_master.yaml} (52%) create mode 100644 .github/workflows/push_into_none_master.yaml rename .github/workflows/{test_maven_actions.yaml => push_to_master.yaml} (92%) diff --git a/.github/workflows/build-action.yaml b/.github/workflows/pr_into_master.yaml similarity index 52% rename from .github/workflows/build-action.yaml rename to .github/workflows/pr_into_master.yaml index 28fd27b..436db2d 100644 --- a/.github/workflows/build-action.yaml +++ b/.github/workflows/pr_into_master.yaml @@ -1,4 +1,4 @@ -name: "Build and test Maven GitHub action" +name: "Build and test release Maven GitHub action" on: pull_request: @@ -46,32 +46,3 @@ jobs: - name: "Validate Maven version" run: mvn -v | head -1 | grep "${{ matrix.maven_version }}" - - build_and_commit: - name: "Set up Maven and validate" - runs-on: ubuntu-latest - - steps: - - name: "Checkout code" - uses: actions/checkout@v2 - - - name: "Set Node.js" - uses: actions/setup-node@v1 - with: - node-version: 12 - - - name: "Install" - run: npm install - - - name: "Commit files" - run: | - git config --local user.email "$(git log --format='%ae' HEAD^!)" - git config --local user.name "$(git log --format='%an' HEAD^!)" - git remote add github "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" - git pull github ${{ github.head_ref }} --ff-only - git add . - if [ -z "$(git status --porcelain)" ]; then - exit 0 - fi - git commit -m "Fix a[href] in Webflow exported html" - git push github HEAD:${{ github.head_ref }} diff --git a/.github/workflows/push_into_none_master.yaml b/.github/workflows/push_into_none_master.yaml new file mode 100644 index 0000000..67a4cd4 --- /dev/null +++ b/.github/workflows/push_into_none_master.yaml @@ -0,0 +1,49 @@ +name: "Build and test release Maven GitHub action" + +on: + push: + branches: + - !master + +jobs: + build_and_test: + name: "Set up Maven and validate it" + runs-on: ubuntu-latest + steps: + - name: "Checkout code" + uses: actions/checkout@v2 + + - name: "Set Node.js" + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: "Install" + run: npm install + + - name: "Run build" + run: npm run build + + - name: "Install ncc" + run: npm i -g @vercel/ncc + + - name: "Run distribution" + run: npm run build-dist + + - name: "Set up JDK" + uses: actions/setup-java@v2 + with: + java-version: "8" + distribution: "adopt" + + - name: "Set Maven from local GitHub action" + uses: ./ + with: + maven-version: 3.8.1 + + - name: "Validate Maven version" + run: mvn -v | head -1 | grep "3.8.1" + + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "Apply local changes" diff --git a/.github/workflows/test_maven_actions.yaml b/.github/workflows/push_to_master.yaml similarity index 92% rename from .github/workflows/test_maven_actions.yaml rename to .github/workflows/push_to_master.yaml index 18bb195..0f03476 100644 --- a/.github/workflows/test_maven_actions.yaml +++ b/.github/workflows/push_to_master.yaml @@ -1,4 +1,4 @@ -name: "Test Maven GitHub action" +name: "Test master branch Maven GitHub action" on: push: