Release #16
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*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build and Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| attestations: write | |
| strategy: | |
| matrix: | |
| include: | |
| - goos: linux | |
| goarch: amd64 | |
| suffix: linux-x86_64 | |
| - goos: linux | |
| goarch: arm64 | |
| suffix: linux-aarch64 | |
| - goos: darwin | |
| goarch: amd64 | |
| suffix: darwin-x86_64 | |
| - goos: darwin | |
| goarch: arm64 | |
| suffix: darwin-aarch64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.21' | |
| - name: Run tests | |
| run: go test ./... -short | |
| - name: Build binary | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: 0 | |
| run: | | |
| go build -ldflags "-s -w" -o nvim-mindevc-${{ matrix.suffix }} . | |
| gzip -1 nvim-mindevc-${{ matrix.suffix }} | |
| - name: Upload artifact | |
| id: upload_artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nvim-mindevc-${{ matrix.suffix }}.gz | |
| path: nvim-mindevc-${{ matrix.suffix }}.gz | |
| - uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-name: nvim-mindevc-${{ matrix.suffix }}.gz | |
| subject-digest: sha256:${{ steps.upload_artifact.outputs.artifact-digest }} | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| if: always() && needs.build.result == 'success' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Prepare release assets | |
| run: | | |
| mkdir -p release-assets | |
| for dir in nvim-mindevc-*; do | |
| if [ -d "$dir" ]; then | |
| cp "$dir"/* release-assets/ | |
| fi | |
| done | |
| ls -la release-assets/ | |
| - name: Generate checksums | |
| run: | | |
| cd release-assets | |
| sha256sum * > checksums.txt | |
| cat checksums.txt | |
| - name: Get tag information | |
| id: tag_info | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| TAG_SUBJECT=$(git for-each-ref "${{ github.ref }}" --format='%(contents:subject)') | |
| echo "tag_subject=$TAG_SUBJECT" >> $GITHUB_OUTPUT | |
| TAG_BODY=$(git for-each-ref "${{ github.ref }}" --format='%(contents:body)') | |
| echo "tag_body<<EOF" >> $GITHUB_OUTPUT | |
| echo "$TAG_BODY" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Determine release type and tag | |
| id: release_info | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
| echo "is_tag_release=true" >> $GITHUB_OUTPUT | |
| echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| echo "release_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| PRERELEASE=$((echo '${{ github.ref_name }}' | grep -qP 'v.+-') && echo true || echo false) | |
| echo "prerelease=$PRERELEASE" >> $GITHUB_OUTPUT | |
| else | |
| echo "is_tag_release=false" >> $GITHUB_OUTPUT | |
| echo "tag_name=nightly" >> $GITHUB_OUTPUT | |
| echo "release_name=Nightly $(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| echo "prerelease=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Delete existing nightly release | |
| if: steps.release_info.outputs.is_tag_release == 'false' | |
| run: | | |
| gh release delete nightly --yes || true | |
| git push origin :refs/tags/nightly || true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag_name: ${{ steps.release_info.outputs.tag_name }} | |
| name: ${{ steps.release_info.outputs.release_name }} | |
| prerelease: ${{ steps.release_info.outputs.prerelease }} | |
| files: | | |
| release-assets/* | |
| body: | | |
| ## ${{ steps.tag_info.outputs.tag_subject || (steps.release_info.outputs.is_tag_release == 'true' && 'Release' || 'Nightly build from main branch') }} | |
| ${{ steps.tag_info.outputs.tag_body }} | |
| ## Installation | |
| Download the appropriate binary for your platform and make it executable: | |
| ```bash | |
| # Linux x86_64 | |
| wget https://github.com/${{ github.repository }}/releases/download/${{ steps.release_info.outputs.tag_name }}/nvim-mindevc-linux-x86_64.gz | |
| gunzip nvim-mindevc-linux-x86_64.gz | |
| chmod +x nvim-mindevc-linux-x86_64 | |
| sudo mv nvim-mindevc-linux-x86_64 /usr/local/bin/nvim-mindevc | |
| # Linux aarch64 | |
| wget https://github.com/${{ github.repository }}/releases/download/${{ steps.release_info.outputs.tag_name }}/nvim-mindevc-linux-aarch64.gz | |
| gunzip nvim-mindevc-linux-aarch64.gz | |
| chmod +x nvim-mindevc-linux-aarch64 | |
| sudo mv nvim-mindevc-linux-aarch64 /usr/local/bin/nvim-mindevc | |
| ``` |