From cf482a5e80c4e2927ab5169ab9d2b88973acda7f Mon Sep 17 00:00:00 2001 From: Uzlopak Date: Thu, 3 Nov 2022 14:19:36 +0100 Subject: [PATCH 1/2] Update and rename test.yml to ci.yml --- .github/workflows/{test.yml => ci.yml} | 52 +++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 5 deletions(-) rename .github/workflows/{test.yml => ci.yml} (62%) diff --git a/.github/workflows/test.yml b/.github/workflows/ci.yml similarity index 62% rename from .github/workflows/test.yml rename to .github/workflows/ci.yml index fb9c478..169f1eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,55 @@ -name: Test +name: CI -on: [push, pull_request] +on: + pull_request: + push: + branches: + - main + - 'releases/*' jobs: - request: + build: + permissions: + contents: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - id: ref + run: | + if [[ -n '${{ github.event.ref }}' ]]; then + branch="${{ github.event.ref }}" + echo "branch=$branch" >> $GITHUB_OUTPUT + else + branch="${{ github.event.pull_request.head.ref }}" + echo "branch=$branch" >> $GITHUB_OUTPUT + fi + - name: checkout repo + uses: actions/checkout@v3 + with: + ref: ${{ steps.ref.outputs.branch }} + - uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Install dependencies + run: | + npm ci + - name: Build Action + run: | + npm run build + - name: Update dist + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + git add ./dist + if ! git diff --quiet dist; then + git commit -m "Update dist" + git push origin HEAD:${{ steps.ref.outputs.branch }} + fi + test: + needs: + - build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 with: ref: ${{ github.ref }} @@ -53,7 +96,6 @@ jobs: - name: Create Test File run: | echo "test" > testfile.txt - - name: Request Postman Echo POST Multipart uses: ./ with: From 5bbd839c3e8f1c3e14d42a5a9be3756c0355f009 Mon Sep 17 00:00:00 2001 From: Uzlopak Date: Thu, 3 Nov 2022 14:29:31 +0100 Subject: [PATCH 2/2] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 169f1eb..92696d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: - build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.ref }}