Skip to content

Commit

Permalink
ci: GitHub workflow definition to automatically release and publish t…
Browse files Browse the repository at this point in the history
…he extension
  • Loading branch information
delafthi committed Feb 22, 2023
1 parent 4f9f4ee commit a478aba
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/main.yml
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 }}

0 comments on commit a478aba

Please sign in to comment.