Skip to content

Create F* release and publish #87

Create F* release and publish

Create F* release and publish #87

Workflow file for this run

name: Create F* release and publish
on:
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run: just build, do not publish'
default: false
type: boolean
target_sha:
description: 'Commit SHA to release (default: HEAD of default branch)'
default: ''
type: string
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: write
env:
DRY_RUN: ${{ github.event.inputs.dry_run || false }}
# Use the provided SHA, or fall back to the SHA that triggered the workflow.
TARGET_SHA: ${{ github.event.inputs.target_sha || github.sha }}
jobs:
# Bump version number beforehand, or use the weekly-release workflow
# which automates the bump + release cycle.
# At least check for it, so we don't run this whole thing and fail
# for an existing tag.
pre:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ env.TARGET_SHA }}
submodules: true
- if: env.DRY_RUN != 'true' # don't check on a dry run.
run: |
git fetch --tags
V="v$(cat version.txt)"
if git tag -l "$V" | grep -q .; then
echo "::error::Version $V already exists (as a tag). Bump the version number in version.txt before running this workflow." >&2
false
fi
build-all:
needs: pre
uses: ./.github/workflows/build-all.yml
with:
ref: ${{ github.event.inputs.target_sha || '' }}
publish:
runs-on: ubuntu-latest
needs: build-all
steps:
- name: Set up git
run: |
git config --global user.name "Dzomo, the Everest Yak"
git config --global user.email "24394600+dzomo@users.noreply.github.com"
- uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
# ^ Download all artifacts into the same dir.
# Each of them is a single file, so no clashes happen.
- uses: actions/checkout@v6
with:
ref: ${{ env.TARGET_SHA }}
submodules: true
path: FStar
- name: Rename packages to have version number
run: |
V="v$(cat FStar/version.txt)"
for file in artifacts/fstar-*; do
mv "$file" "${file/fstar-/fstar-$V-}"
done
- name: Publish release
if: env.DRY_RUN != 'true'
working-directory: FStar
env:
GH_TOKEN: ${{ github.token }}
run: |
V=$(cat version.txt)
# --target with a specific SHA makes sure that if master
# advanced while we were running, the release is still created
# at the commit where this workflow started. Note however
# that it seems this workflow seems to fail when trying
# to tag something other than the lates commit on master
# (probably some Github config should be changed).. but that's
# preferable to silently tagging something untested.
TAG="v$V"
# Create and push annotated tag to repo.
git tag -a -m "F* version $V" "$TAG" "${{ env.TARGET_SHA }}"
git push origin "$TAG"
# Create github release.
gh release create --latest \
--generate-notes \
-t "F* v$V" \
"$TAG" ../artifacts/*