Skip to content

Commit

Permalink
feat(ci): use matrix.include to switch target version and other vars
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Oct 24, 2020
1 parent cce2d2c commit 2c763f3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
35 changes: 19 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,45 @@ 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:
submodules: true
- 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
26 changes: 16 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2c763f3

Please sign in to comment.