-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# 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}} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Changelog | ||
## First release | ||
|
||
- Setup of the CI/CD | ||
|
||
# 0.0.5 - Unreleased | ||
Next version will be 0.0.6 | ||
|
||
# To write a release note | ||
|
||
Ensure that the first title is matching the correct verion with the format | ||
``` | ||
# <version> [- stuff] | ||
``` | ||
No space are allowed in version which shall follow the semver format. | ||
|
||
Then run the following bash command to extraxt the first section of the CHANGELOG.md | ||
```bash | ||
head -n $((`grep -n -m 2 '^# ' CHANGELOG.md | sed 's/:.\+//g' | tail -n 1`-1)) CHANGELOG.md | ||
``` | ||
|
||
Run the following to extract the latest version: | ||
```bash | ||
grep -m 1 "^# " CHANGELOG.md | sed 's/# \([^ ]*\)\+/\1/' | ||
``` |