-
Notifications
You must be signed in to change notification settings - Fork 4
132 lines (114 loc) · 4.19 KB
/
release.yml
File metadata and controls
132 lines (114 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
actions: read
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup date
shell: bash
run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Restore Neovim cache
id: cache-neovim-restore
uses: actions/cache/restore@v4
with:
path: ${{ runner.temp }}/nvim
key: neovim-cache-${{ env.DATE }}-stable
- name: Install Neovim
if: steps.cache-neovim-restore.outputs.cache-hit != 'true'
shell: bash
run: |
mkdir -p ${{ runner.temp }}/nvim
wget -q https://github.com/neovim/neovim/releases/download/stable/nvim-linux-x86_64.appimage -O ${{ runner.temp }}/nvim/nvim.appimage
cd ${{ runner.temp }}/nvim
chmod a+x ./nvim.appimage
./nvim.appimage --appimage-extract
- name: Save Neovim cache
if: steps.cache-neovim-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ runner.temp }}/nvim
key: neovim-cache-${{ env.DATE }}-stable
- name: Add Neovim to PATH
shell: bash
run: |
echo "${{ runner.temp }}/nvim/squashfs-root/usr/bin/" >> $GITHUB_PATH
- name: Neovim version
run: nvim --version
- name: Test Cache
uses: actions/cache@v4
with:
path: .tests
key: ${{ runner.os }}-tests-${{ hashFiles('tests/minit.lua', 'scripts/test') }}
- name: Run tests
run: |
chmod +x scripts/test
./scripts/test
release:
name: Create Release
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from tag
id: tag_name
run: |
echo "current_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
validation_level: error
version: ${{ steps.tag_name.outputs.current_version }}
path: ./CHANGELOG.md
- name: Check if release exists
id: check_release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -x # Enable debug output
which gh || echo "gh CLI not found!"
echo "Checking for release: ${{ github.ref_name }}"
if gh release view "${{ github.ref_name }}" --repo "${{ github.repository }}" 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Release ${{ github.ref_name }} already exists"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Release ${{ github.ref_name }} does not exist"
fi
- name: Delete existing release if exists
if: steps.check_release.outputs.exists == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
echo "Deleting existing release ${{ github.ref_name }}..."
gh release delete "${{ github.ref_name }}" --repo "${{ github.repository }}" -y
- name: Create Archives
run: |
mkdir -p sort-nvim
cp -r lua plugin README.md LICENSE CHANGELOG.md sort-nvim/
tar -czf sort-nvim-${{ steps.tag_name.outputs.current_version }}.tar.gz sort-nvim
zip -r sort-nvim-${{ steps.tag_name.outputs.current_version }}.zip sort-nvim
- name: Create Release with Assets
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
name: Release v${{ steps.tag_name.outputs.current_version }}
body: ${{ steps.changelog_reader.outputs.changes }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
fail_on_unmatched_files: false
files: |
LICENSE
sort-nvim-${{ steps.tag_name.outputs.current_version }}.tar.gz
sort-nvim-${{ steps.tag_name.outputs.current_version }}.zip