From fbd5930824b129693fd9a1d195f1880f5b0a2285 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Wed, 16 Nov 2022 00:34:10 -0700 Subject: [PATCH] fix and refactor build workflows - set Node.js version - define build command in workflow file - remove unused dispatch - add name to all workflows - add name to all steps - clean up formatting --- .github/actions/build.sh | 3 --- .github/actions/dispatch.sh | 6 ----- .github/workflows/pr.yml | 20 +++++++++------- .github/workflows/push.yml | 43 +++++++++++++++++------------------ .github/workflows/release.yml | 40 ++++++++++++++++---------------- 5 files changed, 53 insertions(+), 59 deletions(-) delete mode 100755 .github/actions/build.sh delete mode 100755 .github/actions/dispatch.sh diff --git a/.github/actions/build.sh b/.github/actions/build.sh deleted file mode 100755 index 491f8292..00000000 --- a/.github/actions/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -npm install -npm install gulp-cli -gulp bundle diff --git a/.github/actions/dispatch.sh b/.github/actions/dispatch.sh deleted file mode 100755 index 0e281b8e..00000000 --- a/.github/actions/dispatch.sh +++ /dev/null @@ -1,6 +0,0 @@ -set -e -REPOSITORY_REF="$1" -TOKEN="$2" - -curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${TOKEN}" --request POST --data '{"event_type": "request-build"}' https://api.github.com/repos/${REPOSITORY_REF}/dispatches -echo "Requested Build for $REPOSITORY_REF" diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0a4544f0..7dc915d1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,14 +1,18 @@ -name: reference - +name: On PR on: pull_request: - branches-ignore: - - 'gh-pages' + branches: [main] jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout Source - uses: actions/checkout@v2 - - name: Build - run: ${GITHUB_WORKSPACE}/.github/actions/build.sh + - name: Checkout + uses: actions/checkout@v3 + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Build + run: | + npm ci + npx gulp bundle diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 083f5854..1301e1e1 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,29 +1,28 @@ +name: On Push on: push: - branches-ignore: - - 'gh-pages' - tags-ignore: - - '*' + branches: [main] + tags-ignore: ['**'] workflow_dispatch: -env: - GH_TOKEN_DISPATCH: ${{ secrets.GH_TOKEN_DISPATCH }} - jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Use Node.js 14.17.0 - uses: actions/setup-node@v1 - - name: Build - run: ${GITHUB_WORKSPACE}/.github/actions/build.sh - - uses: "marvinpinto/action-automatic-releases@v1.2.1" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" - prerelease: true - title: "Development Build" - files: | - build/*.zip - - name: Dispatch Build Request - run: ${GITHUB_WORKSPACE}/.github/actions/dispatch.sh 'rwinch/spring-reference' "$GH_TOKEN_DISPATCH" + - name: Checkout + uses: actions/checkout@v3 + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Build + run: | + npm ci + npx gulp bundle + - name: Release + uses: marvinpinto/action-automatic-releases@v1.2.1 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: latest + prerelease: true + title: Development Build + files: [build/ui-bundle.zip] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ba864608..dc6874be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,26 +1,26 @@ +name: On Tag on: push: - branches-ignore: - - '*' - tags: - - 'v*' + branches-ignore: ['**'] + tags: ['v*'] workflow_dispatch: -env: - GH_TOKEN_DISPATCH: ${{ secrets.GH_TOKEN_DISPATCH }} - jobs: - tagged-release: - name: "Tagged Release" + build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Use Node.js 14.17.0 - uses: actions/setup-node@v1 - - name: Build - run: ${GITHUB_WORKSPACE}/.github/actions/build.sh - - uses: "marvinpinto/action-automatic-releases@v1.2.1" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false - files: | - build/*.zip + - name: Checkout + uses: actions/checkout@v3 + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Build + run: | + npm ci + npx gulp bundle + - name: Release + uses: marvinpinto/action-automatic-releases@v1.2.1 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + prerelease: false + files: [build/ui-bundle.zip]