fix: use version without prefix

This commit is contained in:
Bart van der Braak 2023-11-09 12:10:06 +01:00
parent b16f05bdd5
commit a24661c152

View file

@ -10,14 +10,21 @@ jobs:
pre-check: pre-check:
name: Pre-check name: Pre-check
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
version: ${{ steps.version-check.outputs.version }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: | - id: version-check
if [[ "$(git describe --tags --abbrev=0)" != "v$(grep -m1 -F 'version =' Cargo.toml | cut -d\" -f2)" ]]; then run: |
version_tag="$(git describe --tags --abbrev=0 | sed 's/^v//')"
version_toml="$(grep -m1 -F 'version =' Cargo.toml | cut -d\" -f2)"
if [[ "$version_tag" != "$version_toml" ]]; then
echo "Error: The git tag does not match the Cargo.toml version." echo "Error: The git tag does not match the Cargo.toml version."
exit 1 exit 1
fi fi
echo "Success: The git tag matches the Cargo.toml version." echo "Success: The git tag matches the Cargo.toml version."
echo "version=$version_toml" >> $GITHUB_OUTPUT
build: build:
needs: pre-check needs: pre-check
@ -108,16 +115,7 @@ jobs:
- name: Extract version - name: Extract version
shell: bash shell: bash
run: | run: |
set -euxo pipefail echo "${{ needs.pre-check.outputs.version }}" > VERSION
version=$(grep -m1 -F 'version =' Cargo.toml | cut -d\" -f2)
if [[ -z "$version" ]]; then
echo "Error: no version :("
exit 1
fi
echo "$version" > VERSION
- name: Package - name: Package
shell: bash shell: bash
@ -148,7 +146,9 @@ jobs:
keyweave-x86_64-pc-windows-gnu/keyweave.exe keyweave-x86_64-pc-windows-gnu/keyweave.exe
sign: sign:
needs: build needs:
- pre-check
- build
name: Checksum and sign name: Checksum and sign
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -183,12 +183,11 @@ jobs:
keyweave-*/keyweave.exe keyweave-*/keyweave.exe
*SUMS* *SUMS*
- name: Create Homebrew inputs - name: Generate SHA256SUM input for Homebrew
id: homebrew-inputs id: homebrew-inputs
run: | run: |
sha256sums="{$(awk '{printf "%s '\''%s'\'': '\''%s'\''", (NR>1 ? "," : ""), $2, $1} END {print ""}' SHA256SUMS)}" sha256sums="{$(awk '{printf "%s '\''%s'\'': '\''%s'\''", (NR>1 ? "," : ""), $2, $1} END {print ""}' SHA256SUMS)}"
echo "sha256sums=$sha256sums" >> $GITHUB_OUTPUT echo "sha256sums=$sha256sums" >> $GITHUB_OUTPUT
echo "version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
- uses: actions/github-script@v6 - uses: actions/github-script@v6
name: Dispatch Homebrew release name: Dispatch Homebrew release
@ -203,7 +202,7 @@ jobs:
workflow_id: 'release.yml', workflow_id: 'release.yml',
ref: 'main', ref: 'main',
inputs: { inputs: {
version: '${{ steps.homebrew-inputs.outputs.version }}', version: '${{ needs.pre-check.outputs.version }}',
sha256sums: JSON.stringify(sha256sums) sha256sums: JSON.stringify(sha256sums)
} }
}) })