Create F* release and publish #62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create F* release and publish | |
on: | |
workflow_dispatch: | |
inputs: | |
dry_run: | |
description: 'Dry run: just build, do not publish' | |
default: false | |
type: boolean | |
env: | |
DRY_RUN: ${{ github.event.inputs.dry_run || false }} | |
jobs: | |
# Bump version number beforehand? I don't think the action can push | |
# that to master (easily). Just remember to do so manually. | |
# 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@v4 | |
- 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 | |
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 "[email protected]" | |
- uses: actions/download-artifact@v4 | |
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@v4 | |
with: | |
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. | |
gh release create --prerelease \ | |
--generate-notes \ | |
--target ${{ github.sha }} \ | |
-t "F* v$V" \ | |
"v$V" ../artifacts/* |