|
9 | 9 |
|
10 | 10 | jobs: |
11 | 11 | build: |
| 12 | + environment: release |
| 13 | + |
12 | 14 | runs-on: ubuntu-latest |
13 | 15 |
|
| 16 | + permissions: |
| 17 | + contents: write |
| 18 | + |
14 | 19 | steps: |
15 | | - - uses: actions/checkout@v2 |
16 | | - - run: | |
17 | | - git config --global user.email "[email protected]" |
18 | | - git config --global user.name "Christopher Schleiden" |
19 | | - - uses: actions/setup-node@v2 |
| 20 | + - uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - uses: actions/setup-node@v3 |
20 | 23 | with: |
21 | | - node-version: "12" |
| 24 | + node-version: "16" |
| 25 | + |
22 | 26 | - run: npm version ${{ github.event.inputs.version }} |
23 | | - - run: npm install |
| 27 | + - run: npm ci |
24 | 28 | - run: npm run package |
25 | | - - name: Create Release |
26 | | - id: create_release |
27 | | - uses: actions/create-release@v1 |
28 | | - env: |
29 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
30 | | - with: |
31 | | - tag_name: "release-v${{ github.event.inputs.version }}" |
32 | | - release_name: "v${{ github.event.inputs.version }}" |
33 | | - draft: false |
34 | | - prerelease: false |
35 | | - - name: Upload Release Asset |
36 | | - id: upload-release-asset |
37 | | - uses: actions/upload-release-asset@v1 |
38 | | - env: |
39 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + |
| 30 | + - name: Create release and upload release asset |
| 31 | + uses: actions/github-script@v6 |
40 | 32 | with: |
41 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
42 | | - asset_path: ./vscode-github-actions-${{ github.event.inputs.version }}.vsix |
43 | | - asset_name: vscode-github-actions-${{ github.event.inputs.version }}.vsix |
44 | | - asset_content_type: application/vsix |
| 33 | + script: | |
| 34 | + const release = await octokit.repos.createRelease({ |
| 35 | + owner: context.repo.owner, |
| 36 | + repo: context.repo.repo, |
| 37 | + tag_name: "release-v${{ github.event.inputs.version }}", |
| 38 | + name: "v${{ github.event.inputs.version }}", |
| 39 | + draft: false, |
| 40 | + prerelease: false |
| 41 | + }); |
| 42 | +
|
| 43 | + const path = "./vscode-github-actions-${{ github.event.inputs.version }}.vsix"; |
| 44 | + const vsix = fs.readFileSync(path); |
| 45 | + await octokit.repos.uploadReleaseAsset({ |
| 46 | + owner: context.repo.owner, |
| 47 | + repo: context.repo.repo, |
| 48 | + release_id: release.data.id, |
| 49 | + data: fs.readFileSync(path).toString(), |
| 50 | + name: "vscode-github-actions-1.0.0.vsix", |
| 51 | + headers: { |
| 52 | + "content-type": "application/vsix", |
| 53 | + "content-length": fs.statSync(path).size |
| 54 | + } |
| 55 | +
|
45 | 56 | - name: Publish to marketplace |
46 | | - uses: HaaLeo/publish-vscode-extension@v0 |
| 57 | + # https://github.com/HaaLeo/publish-vscode-extension/releases/tag/v1.2.0 |
| 58 | + uses: HaaLeo/publish-vscode-extension@c1a0486c5a3eed24e8c21d4e37889a7c4c60c443 |
47 | 59 | with: |
48 | 60 | pat: ${{ secrets.PUBLISHER_KEY }} |
49 | 61 | registryUrl: https://marketplace.visualstudio.com |
50 | 62 | extensionFile: ./vscode-github-actions-${{ github.event.inputs.version }}.vsix |
51 | | - packagePath: "" |
52 | | - - run: git push |
| 63 | + |
| 64 | + - name: Push version bump |
| 65 | + run: | |
| 66 | + git config --global user.email "[email protected]" |
| 67 | + git config --global user.name "GitHub Actions" |
| 68 | + git push |
0 commit comments