From 5c80eac3590f8395755f0afd36722a71fde56e6e Mon Sep 17 00:00:00 2001 From: Dmitry Maslennikov Date: Wed, 21 Oct 2020 15:31:01 +0300 Subject: [PATCH 1/2] releases ci --- .github/workflows/main.yml | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..49be58a --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,55 @@ +name: CI +on: + release: + types: + - released +jobs: + publish: + if: github.event_name == 'release' + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v2 + with: + ref: master + token: ${{ secrets.TOKEN }} + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Prepare build + id: set-version + run: | + VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/} + NEXT_VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.` + tmp=$(mktemp) + git config --global user.name 'ProjectBot' + git config --global user.email 'bot@users.noreply.github.com' + jq --arg version "${NEXT_VERSION}-SNAPSHOT" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json + git add package.json + git commit -m 'auto bump version with release' + git push + jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json + NAME=$(jq -r '.name' package.json)-$VERSION + echo ::set-output name=name::$NAME + mkdir dist + npx vsce package -o ./dist/$NAME.vsix + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + if: runner.os == 'Linux' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./dist/${{ steps.set-version.outputs.name }}.vsix + asset_name: ${{ steps.set-version.outputs.name }}.vsix + asset_content_type: application/zip + - name: Publish to VSCode Marketplace + run: | + [ -n "${{ secrets.VSCE_TOKEN }}" ] && \ + npx vsce publish --packagePath ./dist/${{ steps.set-version.outputs.name }}.vsix -p ${{ secrets.VSCE_TOKEN }} || true + - name: Publish to Open VSX Registry + run: | + [ -n "${{ secrets.OVSX_TOKEN }}" ] && \ + npx ovsx publish --packagePath ./dist/${{ steps.set-version.outputs.name }}.vsix --pat ${{ secrets.OVSX_TOKEN }} || true From 0292f8d54deb7b1a3d188dd9faba2698292c5198 Mon Sep 17 00:00:00 2001 From: Dmitry Maslennikov Date: Wed, 21 Oct 2020 15:45:43 +0300 Subject: [PATCH 2/2] fix paths --- .github/workflows/main.yml | 8 ++++---- .vscodeignore | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 49be58a..97ab2c0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,7 +33,7 @@ jobs: NAME=$(jq -r '.name' package.json)-$VERSION echo ::set-output name=name::$NAME mkdir dist - npx vsce package -o ./dist/$NAME.vsix + npx vsce package -o $NAME.vsix - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1 @@ -42,14 +42,14 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ./dist/${{ steps.set-version.outputs.name }}.vsix + asset_path: ${{ steps.set-version.outputs.name }}.vsix asset_name: ${{ steps.set-version.outputs.name }}.vsix asset_content_type: application/zip - name: Publish to VSCode Marketplace run: | [ -n "${{ secrets.VSCE_TOKEN }}" ] && \ - npx vsce publish --packagePath ./dist/${{ steps.set-version.outputs.name }}.vsix -p ${{ secrets.VSCE_TOKEN }} || true + npx vsce publish --packagePath ${{ steps.set-version.outputs.name }}.vsix -p ${{ secrets.VSCE_TOKEN }} || true - name: Publish to Open VSX Registry run: | [ -n "${{ secrets.OVSX_TOKEN }}" ] && \ - npx ovsx publish --packagePath ./dist/${{ steps.set-version.outputs.name }}.vsix --pat ${{ secrets.OVSX_TOKEN }} || true + npx ovsx publish --packagePath ${{ steps.set-version.outputs.name }}.vsix --pat ${{ secrets.OVSX_TOKEN }} || true diff --git a/.vscodeignore b/.vscodeignore index f369b5e..b936989 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -1,4 +1,5 @@ +.github/** .vscode/** .vscode-test/** .gitignore -vsc-extension-quickstart.md +