build: use github actions

This commit is contained in:
EnixCoda 2020-04-08 14:40:37 +08:00
parent 2dadb747f4
commit e7c31fa050
No known key found for this signature in database
GPG key ID: FE06F5DFC1C9B8E4
3 changed files with 111 additions and 2 deletions

37
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,37 @@
name: Build
on:
push:
branches:
- build/*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache deps
uses: actions/cache@v1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Retrieve vscode icons
uses: actions/checkout@v2
with:
repository: 'vscode-icons/vscode-icons'
path: 'vscode-icons'
- name: Build
run: |
yarn
make build

68
.github/workflows/release-assets.yml vendored Normal file
View file

@ -0,0 +1,68 @@
name: Release assets when push tags
on:
push:
tags:
- v[0-9]+.* # roughly matching version numbers
- test
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Get the ref
id: get_ref
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- uses: actions/checkout@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache deps
uses: actions/cache@v1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Retrieve vscode icons
uses: actions/checkout@v2
with:
repository: 'vscode-icons/vscode-icons'
path: 'vscode-icons'
- name: Build
run: |
yarn
make build
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_ref.outputs.VERSION }}
release_name: ${{ steps.get_ref.outputs.VERSION }}
draft: false
prerelease: false
- name: Generate release zip
run: |
make compress
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/Gitako.zip
asset_name: Gitako.zip
asset_content_type: application/zip

View file

@ -14,13 +14,17 @@ upload-for-analytics:
yarn sentry-cli releases finalize "$(FULL_VERSION)"
compress:
rm -f dist/gitako.zip
cd dist && zip -r gitako-$(FULL_VERSION).zip * -x *.map -x *.DS_Store
rm -f dist/Gitako.zip
cd dist && zip -r Gitako.zip * -x *.map -x *.DS_Store
rename-compressed:
cd dist && mv Gitako.zip Gitako-$(FULL_VERSION).zip
release:
$(MAKE) build
$(MAKE) upload-for-analytics
$(MAKE) compress
$(MAKE) rename-compressed
$(MAKE) compress-source
compress-source: