|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v[0-9]+.*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + create_release: |
| 10 | + name: Create Release |
| 11 | + runs-on: ubuntu-latest |
| 12 | + outputs: |
| 13 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 14 | + version: ${{ steps.get_version.outputs.version }} |
| 15 | + steps: |
| 16 | + - name: Version |
| 17 | + id: get_version |
| 18 | + run: echo "::set-output name=version::$(echo "${{ github.ref }}" | sed 's/[^.0-9]\+//')" |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v2 |
| 21 | + - name: Describe |
| 22 | + run: | |
| 23 | + CHANGELOG=$(awk -v ver=${{ steps.get_version.outputs.version }} '/## / { if (p) { exit }; if ($2 == ver) { p=1; next } } p' CHANGELOG.md) |
| 24 | + echo "CHANGELOG<<EOF" >> $GITHUB_ENV |
| 25 | + echo "$CHANGELOG" >> $GITHUB_ENV |
| 26 | + echo "EOF" >> $GITHUB_ENV |
| 27 | + - name: Release |
| 28 | + id: create_release |
| 29 | + uses: actions/create-release@v1 |
| 30 | + env: |
| 31 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + with: |
| 33 | + tag_name: ${{ github.ref }} |
| 34 | + release_name: Release ${{ github.ref }} |
| 35 | + draft: false |
| 36 | + prerelease: false |
| 37 | + body: ${{ env.CHANGELOG }} |
| 38 | + |
| 39 | + publish_assets: |
| 40 | + name: Upload Package |
| 41 | + runs-on: ubuntu-latest |
| 42 | + needs: create_release |
| 43 | + steps: |
| 44 | + - name: Checkout |
| 45 | + uses: actions/checkout@v2 |
| 46 | + - name: Install and Build |
| 47 | + run: npm ci |
| 48 | + - name: Package |
| 49 | + run: | |
| 50 | + npx vsce package |
| 51 | + echo "$(npx hasha-cli -a sha256 < vscode-oscript-${{ needs.create_release.outputs.version }}.vsix) vscode-oscript-${{ needs.create_release.outputs.version }}.vsix" > vscode-oscript-${{ needs.create_release.outputs.version }}.vsix.sha256 |
| 52 | + - name: Upload Archive |
| 53 | + uses: actions/upload-release-asset@v1 |
| 54 | + env: |
| 55 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + with: |
| 57 | + upload_url: ${{ needs.create_release.outputs.upload_url }} |
| 58 | + asset_name: vscode-oscript-${{ needs.create_release.outputs.version }}.vsix |
| 59 | + asset_path: vscode-oscript-${{ needs.create_release.outputs.version }}.vsix |
| 60 | + asset_content_type: application/octet-stream |
| 61 | + - name: Upload Checksum |
| 62 | + uses: actions/upload-release-asset@v1 |
| 63 | + env: |
| 64 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + with: |
| 66 | + upload_url: ${{ needs.create_release.outputs.upload_url }} |
| 67 | + asset_name: vscode-oscript-${{ needs.create_release.outputs.version }}.vsix.sha256 |
| 68 | + asset_path: vscode-oscript-${{ needs.create_release.outputs.version }}.vsix.sha256 |
| 69 | + asset_content_type: text/plain |
0 commit comments