From e7c31fa050d0b65da3bf0dd474be7abf0f96f660 Mon Sep 17 00:00:00 2001 From: EnixCoda Date: Wed, 8 Apr 2020 14:40:37 +0800 Subject: [PATCH 1/3] build: use github actions --- .github/workflows/build.yml | 37 +++++++++++++++ .github/workflows/release-assets.yml | 68 ++++++++++++++++++++++++++++ Makefile | 8 +++- 3 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release-assets.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..21921ee --- /dev/null +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/release-assets.yml b/.github/workflows/release-assets.yml new file mode 100644 index 0000000..c47adfe --- /dev/null +++ b/.github/workflows/release-assets.yml @@ -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 diff --git a/Makefile b/Makefile index 02da407..841cd70 100755 --- a/Makefile +++ b/Makefile @@ -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: From 32e1f51d0a6a1f2993d3a31aae46b5f0ad07701f Mon Sep 17 00:00:00 2001 From: EnixCoda Date: Wed, 8 Apr 2020 15:02:21 +0800 Subject: [PATCH 2/3] build: try remove fsevents --- package.json | 1 - yarn.lock | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 8a8afc3..f5e8b81 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,6 @@ "dotenv-webpack": "^1.7.0", "file-loader": "^3.0.1", "fork-ts-checker-webpack-plugin": "^0.5.2", - "fsevents": "^1.2.4", "json-loader": "^0.5.7", "mini-css-extract-plugin": "^0.9.0", "raw-loader": "^4.0.0", diff --git a/yarn.lock b/yarn.lock index 914d9af..06f2cd1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4512,7 +4512,7 @@ fsevents@2.0.7: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.0.7.tgz#382c9b443c6cbac4c57187cdda23aa3bf1ccfc2a" integrity sha512-a7YT0SV3RB+DjYcppwVDLtn13UQnmg0SWZS7ezZD0UjnLwXmy8Zm21GMVGLaFGimIqcvyMQaOJBrop8MyOp1kQ== -fsevents@^1.2.4, fsevents@^1.2.7: +fsevents@^1.2.7: version "1.2.9" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.9.tgz#3f5ed66583ccd6f400b5a00db6f7e861363e388f" integrity sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw== From 99cb4558bb9e2073e1bebcda0f55e790d0f2fce4 Mon Sep 17 00:00:00 2001 From: EnixCoda Date: Wed, 8 Apr 2020 16:15:51 +0800 Subject: [PATCH 3/3] build: ignore most branches for build --- .github/workflows/build.yml | 7 +++++-- .github/workflows/release-assets.yml | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 21921ee..2c8fc16 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,8 +2,11 @@ name: Build on: push: - branches: - - build/* + branches-ignore: + - do-not-build + pull_request: + branches-ignore: + - do-not-build jobs: build: diff --git a/.github/workflows/release-assets.yml b/.github/workflows/release-assets.yml index c47adfe..67da144 100644 --- a/.github/workflows/release-assets.yml +++ b/.github/workflows/release-assets.yml @@ -4,7 +4,6 @@ on: push: tags: - v[0-9]+.* # roughly matching version numbers - - test jobs: release: