Skip to content

v1.0.1

v1.0.1 #21

Workflow file for this run

name: Release Action
on:
release:
types: [released]
jobs:
build-artifacts:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
name: Linux
- target: x86_64-apple-darwin
os: macos-latest
name: macOS
- target: x86_64-pc-windows-msvc
os: windows-latest
name: Windows
file_extension: .exe
runs-on: ${{ matrix.os }}
name: Build ${{ matrix.name }}
env:
binary_name: action${{ matrix.file_extension }}
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Install host target
run: rustup target add ${{ matrix.target }}
- name: Install musl-tools
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
run: sudo apt-get install -y musl-tools
- name: Build
run: cargo build --release --bin action --target ${{ matrix.target }}
- name: Create Archive Folder
run: mkdir ${{ runner.os }}
- name: Copy Artifact
run: cp target/${{ matrix.target }}/release/${{ env.binary_name }} ${{ runner.os }}
- name: Create Tar Archive
run: tar -czf ${{ runner.os }}.tgz ${{ runner.os }}
- name: Store Archive
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}
path: ${{ runner.os }}.tgz
create-release:
needs: [build-artifacts]
runs-on: ubuntu-latest
name: Create Release
permissions:
contents: write
env:
ARTIFACTS: "Linux/Linux.tgz,macOS/macOS.tgz,Windows/Windows.tgz"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: ${{ env.ARTIFACTS }}
tag: ${{ github.event.release.tag_name }}
allowUpdates: true
- name: Extract Major and Minor Versions
id: version_info
run: |
RELEASE_TAG="${{ github.event.release.tag_name }}"
MAJOR_VERSION="${RELEASE_TAG%%.*}"
MINOR_VERSION="${RELEASE_TAG%.*}"
echo "major_version=$MAJOR_VERSION" >> $GITHUB_OUTPUT
echo "minor_version=$MINOR_VERSION" >> $GITHUB_OUTPUT
- name: Create Major Version Release
uses: ncipollo/release-action@v1
with:
artifacts: ${{ env.ARTIFACTS }}
tag: ${{ steps.version_info.outputs.major_version }}
allowUpdates: true
- name: Create Minor Version Release
uses: ncipollo/release-action@v1
with:
artifacts: ${{ env.ARTIFACTS }}
tag: ${{ steps.version_info.outputs.minor_version }}
allowUpdates: true