Skip to content

Create Release

Create Release #16

Workflow file for this run

name: "Create Release"
on:
workflow_dispatch:
inputs:
draft:
required: false
default: true
description: Produce a draft release
type: boolean
jobs:
get-tag:
name: "Create tagged release"
runs-on: ubuntu-latest
outputs:
crate-version: ${{ steps.crate-version.outputs.CRATE_VERSION }}
steps:
- uses: actions/checkout@v3
- name: Get tag
id: "crate-version"
shell: "bash"
run: |
echo CRATE_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' jig-cli/Cargo.toml) >> $GITHUB_OUTPUT
- run: "echo '::notice:: Tag = v${{ steps.crate-version.outputs.CRATE_VERSION }}'"
- name: Create draft release
if: ${{ github.event.inputs.draft }}
run: >
envsubst < .github/release-notes.md |
gh release create "v$CRATE_VERSION" --title "v$CRATE_VERSION" --notes-file - --draft
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
CRATE_VERSION: "${{ steps.crate-version.outputs.CRATE_VERSION }}"
- name: Create release
if: ${{ !github.event.inputs.draft }}
run: >
envsubst < .github/release-notes.md |
gh release create "v$CRATE_VERSION" --notes-file -
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
CRATE_VERSION: "${{ steps.crate-version.outputs.CRATE_VERSION }}"
build:
name: "Build & Upload"
runs-on: ${{ matrix.os }}
needs:
- get-tag
strategy:
fail-fast: false
matrix:
build:
- x86_64-linux
- x86_64-windows
feature:
- "server"
- "cloud"
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
build: x86_64-linux
ext: ""
- target: x86_64-pc-windows-msvc
os: windows-latest
build: x86_64-windows
ext: .exe
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-release-${{ matrix.build }}-${{ matrix.feature }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: cargo-release-${{ matrix.build }}-${{ matrix.feature }}-
- uses: dtolnay/rust-toolchain@nightly
with:
targets: "${{ matrix.target }}"
- name: "Build ${{ matrix.build }} features: ${{ matrix.feature }}"
run: cargo +nightly build --release --features ${{ matrix.feature }} --target ${{ matrix.target }}
env:
RUSTFLAGS: "-Zlocation-detail=none"
- run: mkdir dist
- run: mv target/${{ matrix.target }}/release/jig${{ matrix.ext }} dist/jig-${{ matrix.feature }}-${{ matrix.target }}${{ matrix.ext }}
- run: gh release upload 'v${{ needs.get-tag.outputs.crate-version }}' dist/jig-${{ matrix.feature }}-${{ matrix.target }}${{ matrix.ext }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- run: "echo '::notice:: Upload finished: jig-${{ matrix.feature }}-${{ matrix.target }}${{ matrix.ext }}'"