Merge pull request #451 from flcdrg/dependabot/github_actions/dependa… #604
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 | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
env: | |
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
strategy: | |
matrix: | |
include: | |
- solution: VS2019.slnf | |
os: windows-2019 | |
artifact: VS2019 | |
- solution: VS2022.slnf | |
os: windows-2022 | |
artifact: VS2022 | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.os }} | |
outputs: | |
GitAssemblyInformationalVersion: ${{ steps.gitversion.outputs.GitAssemblyInformationalVersion }} | |
GitBuildVersion: ${{ steps.gitversion.outputs.GitBuildVersion }} | |
GitBuildVersionSimple: ${{ steps.gitversion.outputs.GitBuildVersionSimple }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: setup-msbuild | |
uses: microsoft/setup-msbuild@v2 | |
- name: nuget restore | |
run: nuget restore -Verbosity quiet | |
- name: Build | |
id: build | |
run: | | |
msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m ${{ matrix.solution }} | |
- name: gitversion | |
id: gitversion | |
run: | | |
dir env: | |
echo "::set-output name=GitAssemblyInformationalVersion::$($env:GitAssemblyInformationalVersion)" | |
echo "::set-output name=GitBuildVersion::$($env:GitBuildVersion)" | |
echo "::set-output name=GitBuildVersionSimple::$($env:GitBuildVersionSimple)" | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
# Artifact name | |
name: ${{ matrix.artifact }} | |
# A file, directory or wildcard pattern that describes what to upload | |
path: '**/Release/*.vsix' | |
# - name: Dump steps context | |
# env: | |
# STEPS_CONTEXT: ${{ toJson(steps) }} | |
# run: echo "$STEPS_CONTEXT" | |
update_release_draft: | |
name: Update release draft | |
runs-on: ubuntu-latest | |
needs: [build] | |
env: | |
GitAssemblyInformationalVersion: ${{ needs.build.outputs.GitAssemblyInformationalVersion }} | |
GitBuildVersion: ${{ needs.build.outputs.GitBuildVersion }} | |
GitBuildVersionSimple: ${{ needs.build.outputs.GitBuildVersionSimple }} | |
if: github.ref == 'refs/heads/master' # Running this job only for master branch | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: release-drafter/release-drafter@v6 | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
version: ${{ needs.build.outputs.GitBuildVersionSimple }} | |
- uses: actions/download-artifact@v4 | |
with: | |
path: vsix | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Dump steps context | |
env: | |
STEPS_CONTEXT: ${{ toJson(steps) }} | |
run: echo "$STEPS_CONTEXT" | |
- name: Upload assets | |
uses: xresloader/upload-to-github-release@v1 | |
with: | |
file: "./vsix/**/*.vsix;./.github/extension-manifest-*.json;README.md" | |
overwrite: true | |
release_id: ${{ steps.create_release.outputs.id }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |