-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: GitHub workflow definition to automatically release and publish t…
…he extension
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: "Main" | ||
on: | ||
push: | ||
pull_request: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
cache: "yarn" | ||
- name: Package | ||
run: yarn install | ||
- name: Get Package Assets | ||
if: success() && startsWith(github.ref, 'refs/tags/v') | ||
run: | | ||
echo "VSIX_PATH=$(find . -maxdepth 1 -type f -iname "*.vsix" | head -1)" >> $GITHUB_ENV | ||
echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV | ||
- name: Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
if: success() && startsWith(github.ref, 'refs/tags/v') | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
body: See [CHANGELOG](https://github.com/InES-HPMM/zhaw-snippets/blob/main/CHANGELOG.md) for details. | ||
draft: false | ||
prerelease: false | ||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
if: success() && startsWith(github.ref, 'refs/tags/v') | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ env.VSIX_PATH }} | ||
asset_name: ${{ env.VSIX_NAME }} | ||
asset_content_type: application/zip | ||
- name: Publish | ||
if: success() && startsWith(github.ref, 'refs/tags/v') | ||
run: yarn deploy | ||
env: | ||
VSCE_PAT: ${{ secrets.VSCE_PAT }} |