Skip to content

Commit 2548506

Browse files
author
Pavel Mitrafanau
authored
(#93) Extend workflow to publish a release artifact
1 parent acf5aa5 commit 2548506

File tree

4 files changed

+83
-27
lines changed

4 files changed

+83
-27
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: main
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Set up JDK 11
19+
uses: actions/setup-java@v2
20+
with:
21+
distribution: 'zulu' # See 'Supported distributions' for available options
22+
java-version: '11'
23+
24+
- name: Build VSCode extension
25+
uses: actions/setup-node@v2
26+
with:
27+
node-version: '14'
28+
- run: sudo npm install -g vsce
29+
- run: npm install
30+
- run: npm run compile
31+
- run: vsce package
32+
- uses: actions/cache@v2
33+
with:
34+
path: |
35+
./bazel-ls-vscode-0.0.1.vsix
36+
key: ${{ env.cache-name }}-${{ github.run_id }}
37+
publish:
38+
needs: [build]
39+
if: ${{ success() && contains(github.ref, 'master') }}
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/cache@v2
43+
with:
44+
path: ./bazel-ls-vscode-0.0.1.vsix
45+
key: ${{ env.cache-name }}-${{ github.run_id }}
46+
- name: Create tag
47+
if: contains(github.ref, 'master')
48+
id: create_tag
49+
run: |
50+
tag=builds-$(date +%Y%m%d-%H%M%S)
51+
echo "::set-output name=tag::$tag"
52+
- name: Create Release
53+
if: contains(github.ref, 'master')
54+
id: create_release
55+
uses: actions/create-release@v1
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
with:
59+
tag_name: ${{ steps.create_tag.outputs.tag }}
60+
release_name: ${{ steps.create_tag.outputs.tag }}
61+
draft: true
62+
prerelease: false
63+
- name: Upload Artifact
64+
if: contains(github.ref, 'master')
65+
uses: actions/[email protected]
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
with:
69+
upload_url: ${{ steps.create_release.outputs.upload_url }}
70+
asset_path: ./bazel-ls-vscode-0.0.1.vsix
71+
asset_name: bazel-ls-vscode-0.0.1.vsix
72+
asset_content_type: application/octet-stream
73+
- name: Publish Release
74+
if: contains(github.ref, 'master')
75+
uses: eregon/publish-release@v1
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
with:
79+
release_id: ${{ steps.create_release.outputs.id }}

.vscodeignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ vsc-extension-quickstart.md
1616
gulpfile.js
1717
node_modules
1818
bazel-ls-eclipse/**
19-
!bazel-ls-eclipse/com.salesforce.b2eclipse.jdt.ls/target/com.salesforce.b2eclipse.jdt.ls-*.jar
19+
!bazel-ls-eclipse/com.salesforce.b2eclipse.jdt.ls/target/com.salesforce.b2eclipse.jdt.ls-*.jar
20+
README.md

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
![GitHub Actions](https://github.com/salesforce/bazel-ls-vscode/workflows/main/badge.svg)
12
[![](https://img.shields.io/badge/license-BSD%203-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
23

34
Bazel for Java
@@ -28,4 +29,4 @@ Installation
2829
```
2930
6. Open the _Extensions_ tab in VS Code
3031
7. Select _Install from VSIX..._ and choose file built in the fourth step
31-
8. Once installed, restart VS Code
32+
8. Once installed, restart VS Code

0 commit comments

Comments
 (0)