From 39ab351fdff2da88fc18b6c175ba9a995f92e06e Mon Sep 17 00:00:00 2001 From: Marcell Spies Date: Sun, 22 Nov 2020 16:07:53 +0100 Subject: [PATCH] Refactored build steps into separate action. --- .github/actions/build/action.yml | 19 +++++++++++++++++++ .github/workflows/node.js.yml | 19 +------------------ .github/workflows/release.yml | 31 +++++++++---------------------- 3 files changed, 29 insertions(+), 40 deletions(-) create mode 100644 .github/actions/build/action.yml diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml new file mode 100644 index 00000000..a8aba09b --- /dev/null +++ b/.github/actions/build/action.yml @@ -0,0 +1,19 @@ +name: 'Install dependencies and build project' +runs: + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Use Node.js 14.x + uses: actions/setup-node@v1 + with: + node-version: 14.x + + - name: Install grunt-cli + run: npm install -g grunt-cli + + - name: Install local dependencies + run: npm install + + - name: Run CI build + run: npm run-script ci diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index eebc3fa5..d36264f7 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -15,21 +15,4 @@ jobs: node-version: [14.x] steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Install global dependencies - run: | - npm install -g grunt-cli - npm install -g pkg@4.3.0 - - - name: Install local dependencies - run: npm install - - - name: Run CI build - run: npm run-script ci + - uses: ./.github/actions/build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d0aab349..d44a0e56 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,30 +9,17 @@ jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [14.x] - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Install global dependencies - run: | - npm install -g grunt-cli - npm install -g pkg + - uses: ./.github/actions/build + + release: + runs-on: ubuntu-latest + needs: build - - name: Install local dependencies - run: npm install + steps: + - name: Install pkg dependency + run: npm install -g pkg - - name: Run CI build - run: npm run-script ci - - name: Build Release Package run: npm run-script pkg @@ -43,7 +30,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} + release_name: ${{ github.ref }} draft: true prerelease: false