Enable CD #1
Workflow file for this run
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
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. | |
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml | |
name: VSIX Generation | |
on: | |
push: | |
tags: [ "[0-9]+.[0-9]+.[0-9]+*" ] | |
jobs: | |
build: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fetch dependencies | |
run: npm install | |
- name: Build | |
run: npm run publish | |
- name: Rename file | |
run: mv diplomat-host-*.vsix diplomat-host-${{ github.ref_name }}.vsix | |
- name: Upload artifacts - main app | |
uses: actions/upload-artifact@v4 | |
if: ${{ success() }} | |
with: | |
name: diplomat-vscode-${{ github.ref_name }} | |
path: ${{github.workspace}}/diplomat-host-${{ github.ref_name }}.vsix | |
overwrite: true | |
if-no-files-found: error | |
# Is a binary | |
compression-level: 0 | |
- name: Upload artifacts - CHANGELOG | |
uses: actions/upload-artifact@v4 | |
if: ${{ success() }} | |
with: | |
name: CHANGELOG-${{ github.ref_name }} | |
path: ${{github.workspace}}/CHANGELOG.md | |
overwrite: true | |
if-no-files-found: error | |
light-debug: | |
if: false | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure CMake | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDIPLOMAT_VERSION=${{ github.ref_name }} | |
- name: Upload artifacts - CHANGELOG | |
uses: actions/upload-artifact@v4 | |
if: ${{ success() }} | |
with: | |
name: CHANGELOG-${{ github.ref_name }} | |
path: ${{github.workspace}}/CHANGELOG.md | |
overwrite: true | |
if-no-files-found: error | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Process release version | |
id: semver | |
uses: madhead/semver-utils@latest | |
with: | |
version: ${{ github.ref_name }} | |
lenient: false | |
- run: | | |
echo "Tag : ${{github.ref_name}}" | |
echo "Release : ${{steps.semver.outputs.release}}" | |
echo "N Build : ${{steps.semver.outputs.build-parts}}" | |
- name: Retrieve changelog | |
if: ${{ success() }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: CHANGELOG-${{ github.ref_name }} | |
- name: Extract changelog | |
run: | | |
head -n $((`grep -n -m 2 '^# ' ${{github.workspace}}/CHANGELOG.md | sed 's/:.\+//g' | tail -n 1`-1)) ${{github.workspace}}/CHANGELOG.md > ${{github.workspace}}/RELNOTES.md | |
cat ${{github.workspace}}/RELNOTES.md | |
- name: Retrieve artifact | |
if: ${{ success() }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: diplomat-vscode-${{ github.ref_name }} | |
- name: Create main release from tag | |
if: ${{ success() && steps.semver.outputs.release == github.ref_name}} | |
uses: softprops/action-gh-release@v2 | |
with: | |
body_path: ${{github.workspace}}/RELNOTES.md | |
make_latest: true | |
prerelease: false | |
files: | | |
diplomat-host-${{ github.ref_name }}.vsix | |
- name: Create dev release from tag | |
if: ${{ success() && steps.semver.outputs.release != github.ref_name }} | |
uses: softprops/action-gh-release@v2 | |
with: | |
body_path: ${{github.workspace}}/RELNOTES.md | |
make_latest: false | |
prerelease: true | |
name: "Latest Dev Release" | |
files: | | |
diplomat-host-${{ github.ref_name }}.vsix | |
- uses: actions/checkout@v4 | |
if: ${{ success() }} | |
- name: Update latest branch | |
if: ${{ success() }} | |
uses: EndBug/latest-tag@latest | |
with: | |
# You can change the name of the tag or branch with this input. | |
# Default: 'latest' | |
# ref: someCustomTagName | |
# If a description is provided, the action will use it to create an annotated tag. If none is given, the action will create a lightweight tag. | |
# Default: '' | |
# description: Description for the tag | |
# Force-update a branch instead of using a tag. | |
# Default: false | |
force-branch: true | |
# - name: Test | |
# working-directory: ${{github.workspace}}/build | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
# run: ctest -C ${{env.BUILD_TYPE}} | |