on: release: types: [published] jobs: build_and_publish: runs-on: ubuntu-latest steps: - name: Checkout branch from release uses: actions/checkout@v4 with: ref: ${{ github.event.release.target_commitish }} fetch-depth: 0 - name: GitHub Tag Name example run: | echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME" echo "Tag name from github.ref_name: ${{ github.ref_name }}" - name: Install NodeJS uses: actions/setup-node@v4 with: node-version: 20 - name: Install NPM Packages run: | npm i cd ./client npm i cd .. - name: Install VSCE run: npm -g i @vscode/vsce - name: Build Package Files run: npm run package - name: Update package.json Version run: npm version ${{ github.ref_name }} --no-git-tag-version - name: Commit and Push Changes run: | git config user.name "${{ vars.USERNAME_GIT }}" git config user.email "${{ vars.EMAIL_GIT }}" git add package.json git commit -m "Update version to ${{ github.ref_name }}" || echo "No changes to commit." # Get current branch; if detached, resolve to a remote branch that contains this commit BRANCH="$(git rev-parse --abbrev-ref HEAD)" if [[ "$BRANCH" == "HEAD" || -z "$BRANCH" ]]; then # If target_commitish is a branch, use it; if it’s a SHA, find a branch that contains it CANDIDATE='${{ github.event.release.target_commitish }}' if [[ "$CANDIDATE" =~ ^[0-9a-f]{40}$ ]]; then BRANCH="$(git branch -r --contains "$GITHUB_SHA" | sed -n 's|.*origin/||p' | head -n1)" else BRANCH="$CANDIDATE" fi fi if [[ -z "$BRANCH" ]]; then echo "Could not determine branch for push."; git branch -a; exit 1 fi git push origin HEAD:refs/heads/$BRANCH - name: Publish to Visual Studio Marketplace (Pre-Release) if: ${{ github.event.release.prerelease }} run: vsce publish --pre-release env: VSCE_PAT: ${{ secrets.VSCODE_MARKETPALCE }} - name: Publish to Visual Studio Marketplace (Stable) if: ${{ !github.event.release.prerelease }} run: vsce publish env: VSCE_PAT: ${{ secrets.VSCODE_MARKETPALCE }} - name: Pack Extension for Release run: vsce pack - name: Upload VSIX to Release uses: softprops/action-gh-release@v1 with: files: "nx-post-support-*.vsix" # generate_release_notes: true # Automatische Release Notes # draft: false # N # prerelease: false