Outline buggy #158
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: Compile and build the artifact | |
on: | |
push: | |
branches: | |
- main # Change this to your desired branch | |
tags: | |
- '*' | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Install dependencies such as 7zip, plasma-framework etc | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: p7zip-full make plasma-framework jq | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Lint TypeScript | |
run: make lint | |
- name: Alter version number | |
run: | | |
VERSION=${GITHUB_REF#refs\/tags\/} | |
VERSION=$(echo $VERSION | sed 's#/#-#g') | |
if [[ ! -z "${VERSION}" ]]; then | |
echo "Alter version number to ${VERSION}" | |
sed -i "s/v0.1.1/${VERSION}/" metadata.json | |
fi | |
- name: Compile TypeScript and build the artifact | |
run: make build | |
- name: Create Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: kde-tiling-on-drag.kwinscript | |
path: | | |
./kde-tiling-on-drag.kwinscript | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Download the artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: kde-tiling-on-drag.kwinscript | |
- name: Generate release name | |
id: get_release_name | |
env: | |
TAG_NAME: ${{ github.ref_name }} | |
run: | | |
echo "tag_name: ${TAG_NAME}" | |
RELEASE_NAME=release-${TAG_NAME:-latest} | |
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_OUTPUT | |
echo "release_name: ${RELEASE_NAME}" | |
- name: Generate Changelog | |
env: | |
RELEASE_NAME: ${{steps.get_release_name.outputs.RELEASE_NAME}} | |
GITHUB_REF: ${{ github.ref_name }} | |
run: | | |
set +e | |
current_tag=${GITHUB_REF#refs\/tags\/} | |
prev_tag=$(git describe --abbrev=0 --tags --exclude=$current_tag --exclude="$(git describe --abbrev=0 --tags)") | |
first_commit=$(git rev-list --max-parents=0 HEAD) | |
prev_tag=${prev_tag:-$first_commit} | |
set -e | |
echo "first_commit=${first_commit}" | |
echo "prev_tag=${prev_tag}" | |
echo "diff between ${prev_tag} and HEAD" | |
dest=changelog.md | |
echo "## Changelog ${RELEASE_NAME}" > ${dest} | |
git log --no-merges --pretty=format:'- %s - %an' $prev_tag..HEAD >> ${dest} | |
cat ${dest} | |
- name: Display structure of files | |
run: ls -la | |
- name: Create Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release | |
path: | | |
./kde-tiling-on-drag.kwinscript | |
./changelog.md | |
./README.md | |
- name: Create a Release (on tag push) | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'ignore') | |
with: | |
body_path: ./changelog.md | |
name: ${{ steps.get_release_name.outputs.RELEASE_NAME }} | |
draft: ${{ contains(github.ref, 'latest') }} | |
prerelease: ${{ contains(github.ref, 'beta') }} | |
files: | | |
./kde-tiling-on-drag.kwinscript | |
./changelog.md | |
./README.md |