Fixed ci
This commit is contained in:
@@ -2,15 +2,8 @@ name: Build and Release
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
pull_request:
|
|
||||||
release:
|
|
||||||
types:
|
|
||||||
- published
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -28,15 +21,15 @@ jobs:
|
|||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
asset_name: furumi-linux-x86_64
|
asset_name: furumi-linux-x86_64
|
||||||
archive_name: furumi-linux-x86_64.tar.gz
|
archive_ext: tar.gz
|
||||||
binary_name: furumi
|
binary_name: furumi
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
asset_name: furumi-macos-x86_64
|
asset_name: furumi-macos-x86_64
|
||||||
archive_name: furumi-macos-x86_64.tar.gz
|
archive_ext: tar.gz
|
||||||
binary_name: furumi
|
binary_name: furumi
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
asset_name: furumi-windows-x86_64
|
asset_name: furumi-windows-x86_64
|
||||||
archive_name: furumi-windows-x86_64.zip
|
archive_ext: zip
|
||||||
binary_name: furumi.exe
|
binary_name: furumi.exe
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -58,28 +51,29 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
version="${GITHUB_REF_NAME#v}"
|
||||||
|
archive_name="${{ matrix.asset_name }}-${version}.${{ matrix.archive_ext }}"
|
||||||
package_dir="dist/${{ matrix.asset_name }}"
|
package_dir="dist/${{ matrix.asset_name }}"
|
||||||
mkdir -p "$package_dir"
|
mkdir -p "$package_dir"
|
||||||
cp "target/release/${{ matrix.binary_name }}" "$package_dir/"
|
cp "target/release/${{ matrix.binary_name }}" "$package_dir/"
|
||||||
cp README.md "$package_dir/"
|
cp README.md "$package_dir/"
|
||||||
|
|
||||||
if [[ "${{ runner.os }}" == "Windows" ]]; then
|
if [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||||
(cd dist && 7z a "../${{ matrix.archive_name }}" "${{ matrix.asset_name }}")
|
(cd dist && 7z a "../${archive_name}" "${{ matrix.asset_name }}")
|
||||||
else
|
else
|
||||||
tar -C dist -czf "${{ matrix.archive_name }}" "${{ matrix.asset_name }}"
|
tar -C dist -czf "${archive_name}" "${{ matrix.asset_name }}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.asset_name }}
|
name: ${{ matrix.asset_name }}
|
||||||
path: ${{ matrix.archive_name }}
|
path: ${{ matrix.asset_name }}-*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
name: Publish release assets
|
name: Publish release assets
|
||||||
needs: build
|
needs: build
|
||||||
if: github.event_name == 'release'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -89,8 +83,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: artifacts
|
path: artifacts
|
||||||
|
|
||||||
- name: Upload assets to release
|
- name: Create release and upload assets
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
RELEASE_TAG: ${{ github.ref_name }}
|
||||||
run: gh release upload "$RELEASE_TAG" artifacts/*/* --clobber
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
gh release create "$RELEASE_TAG" artifacts/*/* \
|
||||||
|
--title "furumi ${RELEASE_TAG}" \
|
||||||
|
--notes "Release ${RELEASE_TAG}" \
|
||||||
|
--verify-tag
|
||||||
|
|||||||
Reference in New Issue
Block a user