-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andrew Helwer <2n8rn1w1f@mozmail.com>
- Loading branch information
Showing
5 changed files
with
113 additions
and
31 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Rolling Pre-release | ||
on: | ||
push: | ||
branches: [main] | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
env: | ||
DUNE_BUILD_DIR: "_build" | ||
OCAML_VERSION: "5.1.0" | ||
jobs: | ||
publish: | ||
environment: release | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
steps: | ||
- name: Clone repo | ||
uses: actions/checkout@v4 | ||
- name: Install deps on Ubuntu | ||
if: matrix.os == 'ubuntu-latest' | ||
run: sudo apt-get install --yes time | ||
- uses: ocaml/setup-ocaml@v3 | ||
with: | ||
ocaml-compiler: ${{ env.OCAML_VERSION }} | ||
- uses: actions/cache@v4 | ||
id: cache | ||
with: | ||
path: _build_cache | ||
key: ${{ runner.os }}_build_cache | ||
- name: Build TLAPM | ||
run: | | ||
eval $(opam env) | ||
make opam-deps | ||
make opam-deps-opt | ||
# Workaround for https://github.com/tlaplus/tlapm/issues/88 | ||
set +e | ||
for ((attempt = 1; attempt <= 5; attempt++)); do | ||
make clean | ||
make | ||
if [ $? -eq 0 ]; then | ||
make release RELEASE_VERSION=${{ vars.ROLLING_PRERELEASE_VERSION }} | ||
exit $? | ||
fi | ||
done | ||
exit 1 | ||
- name: "Upload release" | ||
run: | | ||
kernel=$(uname -s) | ||
if [ "$kernel" == "Linux" ]; then | ||
OS_TYPE=linux-gnu | ||
elif [ "$kernel" == "Darwin" ]; then | ||
OS_TYPE=darwin | ||
else | ||
echo "Unknown OS: $kernel" | ||
exit 1 | ||
fi | ||
HOST_CPU=$(uname -m) | ||
TLAPM_ZIP=tlapm-${{ vars.ROLLING_PRERELEASE_VERSION }}-$HOST_CPU-$OS_TYPE.tar.gz | ||
echo $TLAPM_ZIP | ||
ls -lh ${{ env.DUNE_BUILD_DIR }} | ||
cat ${{ env.DUNE_BUILD_DIR }}/tlapm-release-version | ||
## Adapted from https://github.com/tlaplus/tlaplus repository | ||
## Crawl release id | ||
DRAFT_RELEASE=$(curl -sS -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases --header "Content-Type: application/json" | jq '.[]| select(.name=="${{ vars.ROLLING_PRERELEASE_GITHUB_NAME }}") | .id') | ||
## Delete old assets and upload replacement assets (if delete fails we still try to upload the new asset) | ||
ID=$(curl -sS -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/$DRAFT_RELEASE/assets --header "Content-Type: application/json" | jq '.[]| select(.name == "$TLAPM_ZIP") | .id') | ||
curl -sS -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/assets/$ID | ||
curl -s -X POST -H "Content-Type: application/zip" -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" https://uploads.github.com/repos/${{ github.repository }}/releases/$DRAFT_RELEASE/assets?name=$TLAPM_ZIP --upload-file ${{ env.DUNE_BUILD_DIR }}/$TLAPM_ZIP |
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
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
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