|
| 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 | + |
| 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 }} |
0 commit comments