feat: add release infrastructure #1
Workflow file for this run
This file contains hidden or 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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Neovim | |
| uses: rhysd/action-setup-vim@v1 | |
| with: | |
| neovim: true | |
| version: stable | |
| - name: Install LuaRocks | |
| uses: leafo/gh-actions-luarocks@v4 | |
| - name: Install dependencies | |
| run: | | |
| luarocks install busted | |
| luarocks install luacov | |
| - name: Run tests | |
| run: | | |
| chmod +x scripts/test | |
| ./scripts/test | |
| 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: true | |
| version: ${{ steps.tag_name.outputs.current_version }} | |
| path: ./CHANGELOG.md | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: Release ${{ github.ref }} | |
| body: ${{ steps.changelog_reader.outputs.changes }} | |
| prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }} | |
| draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }} | |
| - name: Create Archive | |
| 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: Upload Release Assets | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./sort-nvim-${{ steps.tag_name.outputs.current_version }}.tar.gz | |
| asset_name: sort-nvim-${{ steps.tag_name.outputs.current_version }}.tar.gz | |
| asset_content_type: application/gzip | |
| - name: Upload Release Assets (ZIP) | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./sort-nvim-${{ steps.tag_name.outputs.current_version }}.zip | |
| asset_name: sort-nvim-${{ steps.tag_name.outputs.current_version }}.zip | |
| asset_content_type: application/zip |