From 2c763f390c4b4260739b97596517ce7746e5b34c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=E9=87=91=E5=8F=AF=E6=98=8E?= Date: Sat, 24 Oct 2020 14:28:42 +0800 Subject: [PATCH] feat(ci): use matrix.include to switch target version and other vars --- .github/workflows/release.yml | 35 +++++++++++++++++++---------------- .github/workflows/tests.yml | 26 ++++++++++++++++---------- scripts/install.sh | 2 +- 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 674205d5..c0bfbd87 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,15 +8,23 @@ jobs: name: Build and upload binary assets strategy: matrix: - os: [macos-latest, ubuntu-latest] + os: [macos-latest, ubuntu-latest, windows-latest] + include: + - node-version: 14 + - os: macos-latest + target: macos + asset-name: vim-doge-macos.tar.gz + asset-path: ./bin/vim-doge-macos.tar.gz + - os: ubuntu-latest + target: linux + asset-name: vim-doge-linux.tar.gz + asset-path: ./bin/vim-doge-linux.tar.gz + - os: windows-latest + target: win + asset-name: vim-doge-win.tar.gz + asset-path: ./bin/vim-doge-win.tar.gz runs-on : ${{ matrix.os }} - env: - NODE_VERSION: 14 steps: - - name: Get build info - id: build_info - run: | - echo ::set-output name=target::$(echo ${{ runner.os }} | tr '[:upper:]' '[:lower:]') - name: Checkout kkoomen/vim-doge uses: actions/checkout@v2 with: @@ -24,26 +32,21 @@ jobs: - name: Setup nodejs uses: actions/setup-node@v1 with: - node-version: ${{ env.NODE_VERSION }} + node-version: ${{ matrix.node-version }} - run: npm ci --no-save - name: Build binary - run: npm run build:binary -- node${{ env.NODE_VERSION }}-${{ steps.build_info.outputs.target }}-x64 vim-doge-${{ steps.build_info.outputs.target }} + run: npm run build:binary -- node${{ matrix.node-version }}-${{ matrix.target }}-x64 vim-doge-${{ matrix.target }} - name: Get release id: get_release uses: bruceadams/get-release@v1.2.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Get asset info - id: asset_info - run: | - echo ::set-output name=asset_path::./bin/vim-doge-${{ steps.build_info.outputs.target }}.tar.gz - echo ::set-output name=asset_name::vim-doge-${{ steps.build_info.outputs.target }}.tar.gz - name: Upload release asset uses: actions/upload-release-asset@v1.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.get_release.outputs.upload_url }} - asset_path: ${{ steps.asset_info.outputs.asset_path }} - asset_name: ${{ steps.asset_info.outputs.asset_name }} + asset-path: ${{ matrix.asset-path }} + asset-name: ${{ matrix.asset-name }} asset_content_type: application/zip diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 16e2c85d..62eb4c2b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,12 +15,15 @@ jobs: os: [macos-latest, ubuntu-latest, windows-latest] vim-version: [v7.4.2119, head] node-version: [10, 12, 14] + include: + - os: macos-latest + target: macos + - os: ubuntu-latest + target: linux + - os: windows-latest + target: win runs-on: ${{ matrix.os }} steps: - - name: Get build info - id: build_info - run: | - echo ::set-output name=target::$(echo ${{ runner.os }} | tr '[:upper:]' '[:lower:]') - name: Checkout kkoomen/vim-doge uses: actions/checkout@v2 with: @@ -36,7 +39,7 @@ jobs: node-version: ${{ matrix.node-version }} - run: npm ci --no-save - name: Build binary - run: npm run build:binary -- node${{ matrix.node-version }}-${{ steps.build_info.outputs.target }}-x64 + run: npm run build:binary -- node${{ matrix.node-version }}-${{ matrix.target }}-x64 - name: Setup Vim uses: thinca/action-setup-vim@v1 id: vim @@ -53,12 +56,15 @@ jobs: os: [macos-latest, ubuntu-latest, windows-latest] vim-version: [v0.3.2, head] node-version: [10, 12, 14] + include: + - os: macos-latest + target: macos + - os: ubuntu-latest + target: linux + - os: windows-latest + target: win runs-on: ${{ matrix.os }} steps: - - name: Get build info - id: build_info - run: | - echo ::set-output name=target::$(echo ${{ runner.os }} | tr '[:upper:]' '[:lower:]') - name: Checkout kkoomen/vim-doge uses: actions/checkout@v2 with: @@ -74,7 +80,7 @@ jobs: node-version: ${{ matrix.node-version }} - run: npm ci --no-save - name: Build binary - run: npm run build:binary -- node${{ matrix.node-version }}-${{ steps.build_info.outputs.target }}-x64 + run: npm run build:binary -- node${{ matrix.node-version }}-${{ matrix.target }}-x64 - name: Setup Vim uses: thinca/action-setup-vim@v1 id: vim diff --git a/scripts/install.sh b/scripts/install.sh index 013da34e..9f4655b9 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -24,7 +24,7 @@ if [[ $OS == 'Darwin' ]]; then elif [[ $OS == 'Linux' ]]; then TARGET="vim-doge-linux" else - TARGET="vim-doge-win.exe" + TARGET="vim-doge-win" OUTFILE="$OUTFILE.exe" fi