Fix publish release pipeline #15
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
name: CI | |
on: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- release/* | |
env: | |
SOLUTION_FILE_PATH: . | |
jobs: | |
version: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.merge_commit_sha }} | |
fetch-depth: '0' | |
- name: Fetch ${{ github.event.pull_request.base.ref }} | |
run: | | |
git branch ${{ github.event.pull_request.base.ref }} origin/${{ github.event.pull_request.base.ref }} | |
git branch | |
git branch -r | |
- name: Extract major version from release branch | |
if: startsWith(github.event.pull_request.base.ref, 'release/') | |
run: | | |
export MajorVersion=$(echo ${GITHUB_REF#refs/heads/release/v} | cut -d/ -f1) | |
export InitialVersion="${MajorVersion}.0.0" | |
echo "InitialVersion=$InitialVersion" >> $GITHUB_ENV | |
- name: Generate release version | |
id: release-version | |
if: startsWith(github.event.pull_request.base.ref, 'release/') | |
uses: anothrNick/github-tag-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WITH_V: true | |
TAG_CONTEXT: branch | |
DEFAULT_BRANCH: ${{ github.event.pull_request.base.ref }} | |
INITIAL_VERSION: ${{ env.InitialVersion }} | |
RELEASE_BRANCHES: ${{ github.event.pull_request.base.ref }} | |
VERBOSE: true | |
- name: Determine version | |
id: version | |
run: | | |
echo "version=${{ steps.release-version.outputs.new_tag }}" >> $GITHUB_OUTPUT | |
build: | |
uses: ./.github/workflows/_build.yml | |
needs: | |
- version | |
permissions: | |
checks: write | |
with: | |
commit: ${{ github.event.pull_request.merge_commit_sha }} | |
version: ${{ needs.version.outputs.version }} | |
release: | |
needs: | |
- version | |
- build | |
runs-on: windows-2022 | |
permissions: | |
contents: write | |
defaults: | |
run: | |
working-directory: ${{ github.workspace }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.merge_commit_sha }} | |
fetch-depth: '0' | |
- name: Set up Git actions user | |
uses: fregante/setup-git-user@v1 | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.version.outputs.version }} | |
release_name: Release ${{ needs.version.outputs.version }} | |
draft: true | |
prerelease: false | |
- name: Download VSIX job artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: GitTreeFilter-${{ needs.version.outputs.version }}.vsix | |
github-token: ${{ github.token }} | |
repository: ${{ github.repository }} | |
- name: List all files in the workspace | |
run: | | |
Get-ChildItem -Recurse ${{ github.workspace }} | |
- name: Upload VSIX as release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: GitTreeFilter-${{ needs.version.outputs.version }}.vsix | |
asset_name: GitTreeFilter-${{ needs.version.outputs.version }}.vsix | |
asset_content_type: application/zip |